main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here } ,Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher
main()
{
   int i;
   printf("%d",scanf("%d",&i));  // value 10 is given as input here
}

1

Scanf returns number of items successfully read and not 1/0.  Here 10 is given as input.So, number of items read is 1. 

More interview questions and answers

What are the restrictions placed on the values of each case of a switch statement?

If aaaa is an array then why aaaa.length why not aaaa.length()?

What is dynamic typing?

What is static typig?

What is HashMap and Map?

What is an Object and how do you allocate memory to it?

What is UNICODE?

What is a stream and what are the types of Streams and classes of the Streams?

What is the difference between TCP/IP and UDP?

What is Inter-Thread communication?.

What is a thread group?

Why is UTFDataFormatException thrown by DataOutputStream.writeUTF() when serializing a String?

Why is OutOfMemoryError thrown after writing a large number of objects into an ObjectOutputStream?

How can I get the serialVersionUID of a class?

main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

main() { extern int i; i=20; printf("%d",i); }

main() { int i=-1,j=-1,k=0,l=2,a; a=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,a); }

main() { int c=- -2; printf("c=%d",c); }

#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

main() { int a=10; a=!a>14; Printf ("a=%d",a); }

#include main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

#include main() { int a[2][2][2] = {{10,2,3,4},{5,6,7,8}}; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }

#include main() { struct xx { int x=3; char name[]="vivek"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }

#include main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

main() { printf("\nab"); printf("\bsi"); printf("\rha"); }

main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }

#define square(x) x*x main() { int i; i = 125/square(5); printf("%d",i); }

#define square(x) x*x main() { int i; i = 125/square(5); printf("%d",i); }

main() { char *p="hey friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

#include #define i 10 main() { #define i 50 printf("%d",i); }

#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }

main() { printf("%p",main); }

main() { clrscr(); } clrscr();

enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

main() { int i=400,j=300; printf("%d..%d"); }

main() { char *p; p="java"; printf("%c\n",*&*p); }

main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s

void main() { int a=5; printf("%d",a++ + ++a); }

void main() { int i=5; printf("%d",i+++++i); }

#include main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }

main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }

#define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); }

main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

#include main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }

#include main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }

#include main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }

main() { extern int a; a=20; printf("%d",sizeof(a)); }

main() { printf("%d", out); } int out=100;

main() { printf("%d", out); } int out=100;

main() { extern out; printf("%d", out); } int out=100;

#include main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->na

#include main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }

#include main() { struct xx { int x; struct yy { char s; struct xx *p; }; stru

#include main() { struct xx { int x; struct yy { char s; struct xx *p; }; stru

main() { extern int i; i=20; printf("%d",sizeof(i)); }

main() { printf("%d", out); } int out=100;

main() { show(); } void show() { printf("I'm the greatest"); }

main( ) { int m[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf("%u %u %u %d \n",m,*m,**m,***m); printf("%u %u %u %d \n",m+1,*m+1,**m+1,***m+1); }

main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(�%d� ,*a); a++; } p = a; for(j=0; j<5; j++) {

main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(�\n %d %d %d�, ptr-p, *ptr-a, **ptr); *ptr++; printf(

main( ){ static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(�\n %d %d %d�, ptr-p, *ptr-a, **ptr); *ptr++; printf(�\n %d %d %d�, ptr-p

Question : what is the difference between parameter and argument?

What is the difference between class and structure?

What is the difference between an object and a class?

Difference between realloc() and free()?

What is a template?

What is virtual constructors/destructors?

What is the difference between operator new and the new operator?

Difference between "C structure" and "C++ structure".

What is the difference between "overloading" and "overriding"?

Difference between a "assignment operator" and a "copy constructor"

What is the advantage of function overloading according to users point of view?

What is difference between visual c++ & ANSI c++ ?

main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr); *ptr++; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr); *++ptr; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr); ++*ptr; printf("\n %d %d %d", ptr-p, *ptr-a, **ptr); }

main( ) { char *q; int j; for (j=0; j<3; j++) scanf("%s" ,(q+j)); for (j=0; j<3; j++) printf("%c" ,*(q+j)); for (j=0; j<3; j++) printf("%s" ,(q+j)); }

main( ) { void *vp; char ch = "g", *cp = "goofy"; int j = 20; vp = &ch; printf("%c", *(char *)vp); vp = &j; printf("%d",*(int *)vp); vp = cp; printf("%s",(char *)vp + 3); }

main ( ) { static char *s[ ] = {"black", "white", "yellow", "violet"}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf("%s",*--*++p + 3); }

main() { int i, n; char *x = "girl"; n = strlen(x); *x = x[n]; for(i=0; i

int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }

What are the files which are automatically opened when a C file is executed?

what will be the position of the file marker? a: fseek(ptr,0,SEEK_SET); b: fseek(ptr,0,SEEK_CUR);

main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?

What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF)

main() { main(); }

main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }

main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }

main() { char not; not=!2; printf("%d",not); }

#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }

main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }

#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }

What is the difference between far pointer and near pointer?

What are virtual functions?

What is RTTI?

int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }

main() { int *j; { int i=10; j=&i; } printf("%d",*j); }

R4R provides free online tutolrails ,examples for Freshers and experts .We cover core java, tutorials, spring, Hibernate, python, struts, struts 2,c language, spring boot,PHP,MYSQL,C#,ASP.NET,WPF,WCF,Photoshop , JSP, programming, example, Interview questions and answer