Will this program compile? If yes what will be output and why? If not error plz.
void main( )
{
int k=6;
printf ( "k%d" , printf( "%d" , k) ) ;
}
Friday, November 20, 2009
Thursday, November 19, 2009
Thursday, February 14, 2008
Indexing of array elements
Can we use char/float variable for indexing of array elements? For ex,
int arr[10];
arr[ j ] =3;
whether j can be of type char or float?
int arr[10];
arr[ j ] =3;
whether j can be of type char or float?
Thursday, January 31, 2008
C prog to find remainder of a number
This prog finds remainder of a number without using divisor (/), modulus (%) or multiplication (*) operator.
#include
#include
main()
{
int a,b;
printf("enter the value of Dividend=");
scanf("%d",&a);
printf("enter the value of divisor=");
scanf("%d",&b);
if(a>=b)
{
while(a-b>=b)
{
a=a-b;
}
printf("the reminder is =%d",a-b);
}
else
printf(" Dividend must be greater than divisor");
getch();
}
#include
#include
main()
{
int a,b;
printf("enter the value of Dividend=");
scanf("%d",&a);
printf("enter the value of divisor=");
scanf("%d",&b);
if(a>=b)
{
while(a-b>=b)
{
a=a-b;
}
printf("the reminder is =%d",a-b);
}
else
printf(" Dividend must be greater than divisor");
getch();
}
Tuesday, January 29, 2008
C prog to find remainder of a number
A C prog to find remainder of a number without using division (/) or modulus (%)operator.
Friday, January 25, 2008
C prog without a single Semicolon
Yes why not, we can absolutely write a C prog without using a semicolon and having at least one
executable statement.
main()
{
if(printf("hello suriya"))
{
}
}
Another way. (here notice the use of comma operator described in previous post)
main()
{
while(printf("hello suriya"),0)
{
}
}
executable statement.
main()
{
if(printf("hello suriya"))
{
}
}
Another way. (here notice the use of comma operator described in previous post)
main()
{
while(printf("hello suriya"),0)
{
}
}
Subscribe to:
Posts (Atom)