Write one statement equivalent to the following two statementsx=sqr(a);return(x);Choose from one of the alternativesa.return(sqr(a));b.printf("sqr(a)");c.return(a*a*a);d.printf("%d",sqr(a));
A memory of 20 bytes is allocated to a string declared as char *sthen the following two statements are executed:s="Etrance"l=strlen(s);what is the value of l ?a.20b.8c.9d.21
Consider the following structure:struct num nam{int no;char name[25];};struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}};..........printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1);What does the above statement print?a.8,9b.9,9c.8,8d.8,unpredictable value
Consider the following program sigmentint n,sum=1;switch(n) {case 2:sum=sum+2;case 3:sum*=2;break;default:sum=0;} if n=2, what is the value of suma.0b.6c.3d.none
C Standard Input Output Stream In this C tutorial you will learn about standard input stream and standard output stream explained along with syntax and examples C programming language uses the concept of streams to perform input and output operations using the keyboard and to display information on
What is the return value from printf() function?
printf function always returns the number of characters printed. Let us understand this with an example:
main()
{
int a=10;
printf("%d",printf("%d %d %d", a,a,a));
}
In this above program the inner printf i
The declaration of main can be done as
int main()
One more declaration that can be taken by main is command line arguments form
int main(int argc, char *argv[])
or this can also be written as
int main(argc, argv)
int argc;
char *argv[];
NOTE: It is not possible for one to declare the main
When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below
main()
{
int x;
printf(“%d”,x);
z= sample()
}
sample()
{
printf(“Testing program”);
}
Output is
&n
The steps involved in building a C program are:
1. First program is created by using any text editor and the file is stored with extension as .c
2. Next the program is compiled. There are many compilers available like GNU C compiler called as gcc, Sun compiler, Borland compiler which is pop
There are several format specifiers available in printf. The format specifier used varies depending on the data type used for printing. The given below are some of the format specifiers used with printf in C program.
For integer data type the format specifier used with printf is %d or %i
For float
What is the difference between printf and sprintf?
sprintf: Writes formatted data to a character string in memory instead of stdout
Syntax of sprintf is:
#include <stdio.h>
int sprintf (char *string, const char *format
[,item [,item]...]);
Here,
String refers to the pointer to a
Quality Aspects to Check While Writing COBOL Program This article gives a general list which the programmer must check while delivering programs developed in COBOL This can also be used as a general checklist for checking quality of the COBOL program developed mosgoogle Quality is a vital factor fo
How To Write The Main Heading For Your Essay When you write an essay you will want to make sure you write a good heading To write a good heading you will need to plan your essay very effectively If you remember any good points from lectures these could be things you may want to use to create a good
Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie