GeekInterview.com
Series: Subject: Topic:

C FAQs

Showing Questions 1 - 20 of 238 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

The C language terminator isa. Semicolonb. Colonc. Periodd. Exclamation mark

Asked By: Interview Candidate | Asked On: Jun 7th, 2005

Answered by: Anitta Augustine on: May 18th, 2013

Semicolon

Answered by: BHUVANA on: Mar 3rd, 2013

A. Semicolon

Tricky C program questions

Asked By: ganesan81 | Asked On: Jun 5th, 2007

1)write a C program to find a peculiar two digit number which is three times the sum of its digits.2) bacteria are known to multiply very rapidly. If a certain container contains just one bacterium on the first day and there are twice as many on the next day. In this manner the number of bacteria in...

Answered by: Ranjini on: Mar 15th, 2013

Answer to the question 10"c /* * Write a C program to find a two digit number, the second digit of which is * smaller than its first digit by 4, and if the number was divided by ...

Answered by: ranjini on: Mar 15th, 2013

Answer to the question 1"c /* C program to find a peculiar two digit number which is three times the sum * of its digits. * Solution :- * let say number is 10x+y * According ...

Whats the output of.....>>?

Asked By: geekaayuush | Asked On: Sep 7th, 2012

#include #include void main() { int a=1; if(a=1,3,5,6) printf("good&a=%d",a); else printf("bad&a=%d",a); } }

Answered by: FahadFirozKhan on: Jan 23rd, 2013

error: #include expects "FILENAME" or
error: expected identifier or { before } token

#include

void main()
{
int a=1;
if(a=1,3,5,6)
printf("good&a=%d",a);
else
printf("bad&a=%d",a);

}

//Output

good&a=1

Answered by: rahul jadhav on: Nov 21st, 2012

good&a=1

Need help in writing a C program using array and loop statement

Asked By: Abdul Hamid | Asked On: Jun 14th, 2012

Write a C program using arrays and any loop statements that asks the user to enter the number of students. For each student, enter the number of courses. The user should enter the students id number and the marks for each course. Compute and display the total and average of the students marks. sample...

Answered by: memo on: Oct 16th, 2012

use the structure to write this program

Answered by: sree on: Jul 4th, 2012

/*Write a C program using arrays and any loop statements that asks the user to enter the number of students. For each student, enter the number of courses. The user should enter the students ID number...

Program

Asked By: mohawif | Asked On: Dec 21st, 2012

Write a program that asks a user to type in their name, sex, age, roll number and store them! the program should then print the information the user entered (hints: use character arrays for name, sex)

Pointer drawback

Asked By: nipa123456 | Asked On: Aug 22nd, 2010

What is the drawback of using pointer?

Answered by: abhijeetvv on: Dec 11th, 2012

Since the pointers point to a memory location issues of dangling pointers and wild pointers can occur. Dangling pointers are those pointers when the data at which they are pointed may have been modifi...

Stop watch

Asked By: v s.n.reddy | Asked On: Dec 9th, 2012

I want code for stop watch in C C++ & Java.

Main must be written asa. The first function in the programb. Second function in the programc. Last function in the programd. Any where in the program

Asked By: Interview Candidate | Asked On: Jun 6th, 2005

Answered by: neha singh on: Nov 20th, 2012

D. Any where in the program.

Answered by: Karthkeyan on: Apr 20th, 2012

Any where in the program

If we declare a pointer like char *p;how much memory is allocated for pointer variable 'p'.

Asked By: pavankishore | Asked On: Nov 29th, 2006

Star Read Best Answer

Editorial / Best Answer

Answered by: winny gupta

View all answers by winny gupta

Member Since Feb-2007 | Answered On : Feb 15th, 2007

2 bytes of memory because the pointer variable, whatever data type it maybe pointing to is always an unsigned integer as the address is always a positive integer, hence requiring 2 bytes of memory

Answered by: reetu on: Sep 30th, 2012

It allocate 2bytes in memory

Answered by: rasmita sahoo on: May 17th, 2012

2 byte for tc & 4 byte for gcc compiler

When dynamic allocation of memory is done by using malloc then how is the memory allocated in sequential or in some other format ?

Asked By: rpgubba | Asked On: Jun 4th, 2007

Answered by: 001edward on: Sep 20th, 2012

Memory allocated is in some other format

How many times 3 occurs between 3 to 3333

Asked By: vijay | Asked On: Jan 2nd, 2006

Answered by: Dinesh on: Sep 14th, 2012

1336

Answered by: mahamadalig on: May 6th, 2012

Code
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int i,j,k=0;
  6. for(i=3;i<=3333;i++)
  7. {
  8.         j=i%10;
  9.         if(j==3)
  10.         {
  11.                 k=k+1;
  12.         }
  13. }
  14. printf("times %d
  15. ",k);
  16. }

What will be the code for>?

Asked By: Interview Candidate | Asked On: Sep 7th, 2012

Write a program that prompts the user to enter an integer from 1 to 15 and displays a pyramid . For example if the input integer is 6 ,the output is shown below : 1 2 1 2 3 2 1 2 3 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5 6 5 4 3 2 1 2 3 4 5 6

Answered by: vinoth kumar on: Sep 10th, 2012

Code
  1. int main()
  2. {
  3.         int n,m,i,j;
  4.         scanf("%d",&n);
  5.         for(i=1;i<=n;i++)
  6.           { for(j=1;j<=n-i;j++)
  7.                printf(" ");
  8.           for(j=i;j>=1;j--)
  9.               printf("%d        ",j);
  10.            for(j=2;j<=i;j++)
  11.               printf("%d        ",j);
  12.           printf("
  13. ");
  14.           }
  15.         return 0;
  16. }

What is the size of a pointer variable?

Asked By: mithila | Asked On: Sep 15th, 2005

Answered by: Narmadha on: Aug 23rd, 2012

The size of pointer variable depends on the processor architecture that is 32-bit or 64-bit.It may vary according to compiler we are used.

Answered by: Arpita Mishra on: Aug 4th, 2012

The size of a pointer variable is 2 bytes which is the size of unsigned integer as pointer variables are always used to store addresses.

Return multiple values from function

Asked By: vijay.karumuri | Asked On: Apr 14th, 2010

How to return multiple values in C language function?

Answered by: Arpita Mishra on: Aug 4th, 2012

Multiple values can be returned from a function by using call by address i.e. pointers intelligently.

Answered by: jbode on: Jan 3rd, 2012

Strictly speaking, a C function can only *return* a single value; you cant write something like "a,b,c=f();". However, you can write to multiple function parameters in addition to returning a value (...

C program to find a two digit no.

Asked By: mounik | Asked On: Oct 27th, 2011

Write a C program to find a two digit no.. The second digit of which is smaller than its first digit by four and the number was divided by the digits sum, the quotient would be 7.

Answered by: DIVINE FREEDA JOSHUA on: Jun 14th, 2012

The answer is 84

The second digit 4 is smaller than the first digit by 4
sum of the digits is 12
84/12=7

What is the difference between malloc and calloc

Asked By: kshirod kumar mishra | Asked On: Mar 23rd, 2006

Answered by: maha on: May 12th, 2012

malloc is the memory allocation operator whereas calloc is the memory release operator

Answered by: RaviRanjan kumar on: Feb 1st, 2012

malloc: malloc create the single block of given size by user calloc: calloc creates multiple blocks of given size both return void pointer(void *)so boh requires type casting malloc: eg: int *p; p=(...

Swapping of two numbers

Asked By: rabia.sultana14 | Asked On: May 28th, 2011

How to swap two numbers without using temporary variable?

Answered by: mahamadalig on: May 6th, 2012

Code
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int i=54,j=43;
  6. printf("BEFORE SWAPPPED
  7. ");
  8. printf("%d,%d
  9. ",i,j);
  10. i=i+j;
  11. j=i-j;
  12. i=i-j;
  13. printf("BEFORE SWAPPPED
  14. ");
  15. printf("%d,%d
  16. ",i,j);
  17. }

Answered by: Tanuja Jaiswal on: Jan 26th, 2012

#include
void main()
{
int a,b,temp;
printf("Enter values for a and b ");
scanf("%d %d",&a , &b);
printf("values before swaping are : %d %d",a,b);
temp=a;
a=b;
b=temp;
printf("After swaping values are : a= %d b=%d,a,b);
getch();
}

Output of a++ + ++a + a++

Asked By: crackboy | Asked On: Feb 9th, 2008

What is the answer of a++ + ++a + a++ int a=5;c = a++ + ++a + a++;//compiler produces the answer 28!!!//how

Answered by: peter on: Mar 25th, 2012

Which operation in the following expression will be performed first?

c = a++ / b + 5;

Answered by: Asarudeen on: Feb 9th, 2012

c = a++ + ++a + ++a Compiler starts from leftmost operand

Code
  1. 1+5 = 6
  2.  
  3. a = 6
  4.  
  5. 1+6 =7
  6.  
  7. a = 6+7
  8.  
  9. a =13
  10.  
  11. 1+13 =14
  12.  
  13. Now
  14.  
  15. c = 6+ ++7 ++13
  16.  
  17. c = 28

Nested if statement

Asked By: vanidevi | Asked On: Jan 10th, 2008

How many nested if statements are allowed in c?

Answered by: jbode on: Feb 17th, 2012

Per the C language standard, there must be *at least* 127 levels of nesting.

Answered by: aman15490 on: Nov 6th, 2008

There is no such limitations you can use any no of nested if statement.

Short int and int

Asked By: chaitanyawithu | Asked On: Mar 26th, 2008

What is the difference between short int and int?

Answered by: jbode on: Feb 11th, 2012

The general idea is that short "always" represents a 16-bit integer, whereas int represents whatever the native word size is for that particular architecture (16- or 32-bit). "Always" is in scare quo...

Answered by: sumit on: Feb 5th, 2012

Sorry to say that actually in most of C compiler short int is also of 16 bit and they are equivalent to each other.

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.