ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
helllo sir ,
 what is the main use of the pointer ,array ,and the 
structure with the example of a programe
 Question Submitted By :: Pawan Kumar Singh
I also faced this Question!!     Rank Answer Posted By  
 
  Re: helllo sir , what is the main use of the pointer ,array ,and the structure with the example of a programe
Answer
# 1
With the help of pointer we can access a variable 
address.with that we can change the value of the 
variable.for eg: 

main()
{
 int a = 10;
 int *x;
 
 x = &a;
 
 printf("a = %d\n",a);
 *x = 978;
 printf("a = %d\n");
}

now the value of the a is 978.

if we pass a pointer to a variable to a function then the 
value of that variable will be chageed if we change it in 
that function.
for eg: 

main()
{
  int b = 87;
  int *x;
  x = &b;
  fun(x);
  printf("b = %d\n");
}

fun(int *x)
{
  *x = 879;
}

here the value of the b will be 879.

Array : Array is a collection of variable of similar types. 
i.e. it can b an collection of n number of integers or arry 
of characters etc.
for eg:

 Take a examination marks of a class.it could b a float 
value or a integer value.Then u need to take five variables 
of float type or interger type.Insted of that u can take an 
array of float or integer type.

  float marks[n];

arrays r mainly used for strings.

     char string[n];

Structure:
The structure is a collection of variables of  various data 
types.

the best example for this is employee details or student 
details.

   struct emloyee
   {
     char name[25];
     int age;
     float salary;
     char mobile[15];
     char desig[25];
   };






   
 
Is This Answer Correct ?    0 Yes 0 No
Fazlur Rahaman Naik
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen) NetApp1
f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p? Hughes2
what is the differance between pass by reference and pass by value. Infosys4
What is the Difference between Class and Struct? Motorola9
What ios diff. Between %e & %f? Honeywell1
what is the stackpointer  2
11. Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage Accenture5
main() { printf(5+"Vidyarthi Computers"); }  5
1,4,8,13,21,30,36,45,54,63,73,?,?. Franklin-Templeton3
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } CitiGroup13
Which is not valid in C? 1) class aClass{public:int x;} 2) /* A comment */ 3) char x=12;  4
Write the program for displaying the ten most frequent words in a file such that your program should be efficient in all complexity measures. Google3
What is the difference between null pointer and void pointer CTS2
write a program to print sum of each row of a 2D array.  2
what is the difference between const volatile int i & volatile const int j; HCL1
Function to find the given number is a power of 2 or not? Motorola9
what is a static function Satyam9
Why the use of alloca() is discouraged? Oracle2
YBJBU6  1
Design a program using an array that lists even numbers and odd numbers separately from the 12 numbers supplied by a user.  4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com