C Programming and Technical

Q. What are differences between sizeof operator and strlen function?

A. sizeof is keyword of c which can find size of a string constant including null character but strlen is function which has been defined string.h and can find number of characters in a string excluding null character

Read Solution (Total 0)

C Other Question

Q. What is automatic type promotion in c?

A. In c if two operands are of different data type in a binary operation then before performing any operation compiler will automatically convert the operand of lower data type to higher data type. This phenomenon is known as automatic type conversion.

For example:
int a=10,c;
float b=5.5f;
c=a+b;
Here a int variable while b is float variable. So before performing addition operation value of the variable a (Lower data type) will automatically convert into float constant (higher data type) then
it will perform addition operation.
Q. What is command line argument?

A. Getting the arguments from command prompt in c is known as command line arguments. In c main function has three arguments.
They are:
Argument counter
Argument vector
Environment vector