answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

Can an extern be paid?

Yes, an extern can be paid, though it often depends on the specific externship program and the industry. Some externships, particularly in fields like healthcare, engineering, or technology, may offer compensation to attract talent and provide valuable experience. However, many externships are unpaid, focusing instead on providing educational experiences and networking opportunities. It's essential for externs to clarify payment arrangements before beginning their positions.

Full form of basic?

The full form of computer is computer;

BASIC is (or can be seen as) short for 'Beginner's All-purpose Symbolic Instruction Code'.

How many steps are involved in writing a computer program?

It depends on the type of computer program you desire. At the bare minimum you need 3 steps in order to make a simple program. The first that is learning you compiler's language (example: JavaScript, C++, C# ect.) and next is to learn how to avoid syntax errors and then create the program that you want. For example, to make a simple execution program using command prompt you will have to learn the commands of a .bat file and then order the commands correctly in order for command prompt to execute and then let it run. Most of programming is trial and error thought the more you get acquainted with your compiler the easier and better you'll become a making your program.

How would you define Continue statement?

A continue statement is used to "branch" to the end of a loop without exiting the loop. If we wish to exit the loop entirely, use a break or return statement.

for (int i=1; i<10; ++i) {

if (i==5) continue;

printf (%d ", i);

}

printf ("\n");

The above loop will print the following:

1 2 3 4 6 7 8 9

How you get a code of Radix sort?

#include<stdio.h>

void radix(int a[],int n)

{

int i,j,k=1,l,temp,b[10][n],cnt;

int max=a[0],c=0;

for(i=0;i<n;i++)

if(a[i]>max)

max=a[i];

while(max%10)

{

c++;

max/=10;

}

for(i=0;i<10;i++)

for(j=0;j<n;j++)

b[i][j]=-999;

for(l=0;l<c;l++)

{

for(j=0;j<n;j++)

{

temp=(a[j]/k)%10;

b[temp][j]=a[j];

}

k=k*10; cnt=0;

for(i=0;i<10;i++)

for(j=0;j<n;j++)

if(b[i][j]!=-999)

a[cnt++]=b[i][j];

for(i=0;i<10;i++)

for(j=0;j<n;j++)

b[i][j]=-999;

}

}

main()

{

int i,n;

printf("Enter array capacity \t: ");

scanf("%d",&n);

int a[n];

for(i=0;i<n;i++)

a[i]=rand()%100;

printf("\nArray Before Sorting : ");

for(i=0;i<n;i++)

printf("%4d",a[i]);

radix(a,n);

printf("\n\nArray After Sorting : ");

for(i=0;i<n;i++)

printf("%4d",a[i]);

printf("\n");

}

What is the fastest way to compute the factorial of 123456 on a processor of speed 1.4 Ghz 512 mb ram and 40 gb hard disk?

i have solved this problem.....!! i dont know that my Program is fastest than other traditional algos like prime swing etc. MY computer computed factorial of 123456! in appx 14-15 mins. The output was of 5,74,965 digits. actually no computer in this world can support this big answer.

Actually i saved my ans into an array. My program is in C. If any body really interested to see the result & program logic, then contact me at ankitsingh.05@gmail.com.

Regards,

Ankit Singh

Pune

Should you capitalize the letters PS and the end of a letter?

yes you should because they stand for two words. they are not a word by them selves

What is a C program to calculate the number of characters in a string?

#include<stdio.h>

int Strlen (const char* str) {

if (!str) return -1; /* invalid argument */

int count;

count=0;

while (*str++) ++count;

return count;

}

int main (void) {

char str[1024];

scanf ("Enter a string: %s\n", str);

printf ("Length of string: %d\n", Strlen(str));

return 0;

}

What does machine language consists of?

A series of 1's and 0's which represent Instructions.

Assembly Language is a 1-to-1 representation of machine code in human readable context. Assembly Language can also contain comments and label names which get filtered out when converting assembly to machine code (compiling).

If you want to read machine language, you use a disassembler to convert machine code into assembly. Otherwise programs such as notepad or nano will show the contents of the file as gobbly-gook (random characters with no meaning).

32-bit processors parse the file into 32-bit 1's and 0's segments. Each segment gets ran and processed individually. And not all segments are meant to be ran. Some are data and get skipped over, and other instructions load and use that data for their intended purpose.

Can you list morphographs?

You can make a list of them.. of course!

How can a pointer create a perfect copy of a variable?

In order to copy a variable you must copy its value and store that value in another variable, thus creating an independent copy of the value. That is, after the copy, changing one value has no effect upon the other:

void f (int x) {

int x = y;

assert (x == y); // assert the values are the same

assert (&x != &y); // assert the variables occupy different addresses (independent variables)

}

To achieve the same thing with a pointer you must create an independent variable to store the copied value:

void g (int x) {

int* p = malloc (sizeof (int)); // allocate memory to hold the value

*p = x; // copy the value to the allocated memory

assert (*p == x); // assert the values are the same

assert (p != &x); // assert the variables occupy different addresses (independent variables)

// ...

free (p); // release the allocated memory

}

Note that the variable referred to by p is anonymous (has no name). To refer to the value we must dereference the pointer (*p).

Copying a value via a pointer is achieved similarly:

void h (int* p) { int x = *p; // copy the value referred to by p

assert (x == *p); // assert the values are the same

assert (&x != p); // assert the variables occupy different addresses (independent variables)

}

void i (int* p) {

int* p2 = malloc (sizeof (int)); // allocate memory to hold the value

*p2 = *p; // copy the value to the allocated memory

assert (*p2 == *p); // assert the values are the same

assert (p2 != p); // assert the variables occupy different addresses (independent variables)

// ...

free (p2); // release the allocated memory

}

What is a comparative operator?

Comparative operators are used to compare the logical value of one object with another and thus establish the rank (ordering) of those objects.

There are six comparative operators in total:

p<q : evaluates true when p is less than q

p>q : evaluates true when p is greater than q

p<=q : evaluates true when p is less than or equal to q

p>=q : evaluates true when p is greater than or equal to q

p!=q : evaluates true when p is not equal to q

p==q : evaluates true when p is equal to q

How does one declare a string of 49 letters?

char str[50];

Note that you must include the null-terminator, thus you need 50 characters to store a string of 49 letters.

Alternatively, you can use dynamic allocation:

char* p;

p = malloc (50 * sizeof(char));

/* ... */

free (p);

What is an RF loop?

An RF loop, or radio frequency loop, is a type of antenna design characterized by its circular or looped shape, which is used to receive or transmit radio frequency signals. It is often employed in applications such as RFID systems, wireless communication, and certain types of sensors. The loop's geometry allows for improved efficiency and selective reception of specific frequencies, making it effective in various RF applications. Additionally, RF loops can be compact and easily integrated into different devices.

What is the function of sleep?

== == See the Related Links for "Sleep" to the bottom for the answer.

What is the difference between the structure tag and structure variable?

The structure tag is a type. The structure variable is an instance of that type.