Is the following code legal? typedef struct a aType; struct a { int x; aType *b; }; ,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
Is the following code legal?

typedef struct a aType;
struct a
{
   int x;
   aType *b;
};

Yes

The typename aType is known at the point of declaring the structure, because it is already typedefined.

More interview questions and answers

main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

What is the diffrence between static_cast and dynamic_cast in RTTI

main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

What is a fake pointer?

What is importance of const. pointer in copy constructor?

What is the difference between a pointer and a reference?

What is Smart Pointer?

How to Configure SMTP in asp .NET?

Print Hello World message using SharePoint in Asp.Net 2.0?

How to create a SharePoint web part using File upload control.give example?

What is BulletedList Control in Share Point. Give an example?

DescribeWizard server control with example in Share Point?

Define Life Cycle of Page in ASP.NET?

Write a program in ASP.NET to Show Data With Access?

Write a program to show connection with Oracle in ASP.NET?

Write a program to show connection to Excel in ASP.NET?

How to add Record in ASP.NET?

Write a program to Delete Record in ASP.NET ?

Write a program to show data in Gridview in ASP.NET?

Write a Program to Connect with dropdownlist in ASP.NET

How Repeater is used in ASP.NET?

How to show data in HTML table using Repeater?

Write a program to show the Use of dataList in ASP.NET?

How to make User Control in ASP.net?

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

main() { int a=2,*f1,*f2; f1=f2=&a; *f2+=*f2+=a+=2.5; printf("\n%d %d %d",a,*f1,*f2); }

main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }

#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf("The dimension of the array is %d", DIM(arr, int)); }

int DIM(int array[]) { return sizeof(array)/sizeof(int ); } main() { int arr[10]; printf("The dimension of the array is %d", DIM(arr)); }

main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j),*(*(j+p)+i),*(*(i+p)+j), *(*(p+j)+i)); } }

main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }

main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

#include main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr

Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

There were 10 records stored in "somefile.dat" but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen("somefile.dat","r"); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }

Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++

What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }

What is the hidden bug with the following statement?

What is the hidden bug with the following statement? assert(val++ != 0);

void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }

#define assert(cond) if(!(cond)) \(fprintf(stderr, "assertion failed: %s, file %s, line %d \n",#cond,\__FILE__,__LINE__), abort()) void main() { int i = 10; if(i==0) assert(i < 100); else printf("This statement becomes else for if in assert macro"); }

Is the following code legal? struct a { int x; struct a b; }

Is the following code legal? struct a { int x; struct a *b; }

Is the following code legal? typedef struct a { int x; aType *b; }aType

Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }

void main() { printf("sizeof (void *) = %d \n", sizeof( void *)); printf("sizeof (int *) = %d \n", sizeof(int *)); printf("sizeof (double *) = %d \n", sizeof(double *)); printf("sizeof(struct unknown *) = %d \n", sizeof(struct unknown *)); }

char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

Which version do you prefer of the following two, 1) printf("%s",str); // or the more curt one 2) printf(str)

What is Operator overloading?

What is the difference between run time binding and compile time binding?

What is Difference Between C/C++?

What is Difference Between C/C++

What will be the output of the following code? void main (){ int i = 0 , a[3] ; a[i] = i++; printf ("%d",a[i]) ; }

Why doesn't the following code give the desired result?

Why doesn't the following statement work? char str[ ] = "Hello" ; strcat ( str, '!' )

How do I know how many elements an array can hold?

How do I write code that reads data at memory location specified by segment and offset?

Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible ?

What about Virtual Destructor?

What is problem with Runtime type identification?

How Virtual functions call up is maintained?

Can inline functions have a recursion?

How do you link a C++ program to C functions?

Explain the scope resolution operator?

How many ways are there to initialize an int with a constant?

What is the difference between a copy constructor and an overloaded assignment operator?

When should you use multiple inheritance?

What is a virtual destructor?

n a constructor throw a exception? How to handle the error when the constructor fails?

What are the debugging methods you use when came across a problem?

How the compilers arranges the various sections in the executable image?

Explain the ISA and HASA class relationships. How would you implement each in a class design?

When is a template a better solution than a base class?

How do you know that your class needs a virtual destructor?

What is the difference between new/delete and malloc/free?

What happens when a function throws an exception that was not specified by an exception specification for this function?

Can you think of a situation where your program would crash without reaching the breakball, which you set at the beginning of main()?

What issue do auto_ptr objects address?

Why do C++ compilers need name mangling?

Is there anything you can do in C++ that you cannot do in C?

How do you decide which integer type to use?

What�s the best way to declare and define global variables?

What does extern mean in a function declaration?

How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

Declare a void pointer.

What is 'this' pointer?

What is the mean of Manglic in C++?

What are the access privileges in C++?

Explain the scope resolution operator?

What is a modifier?

wat do you mean by accessor?

give me a diff b/e Template class and class Template?

What are the types of container classes?

When does a name clash occur?

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