o/p tracing

#include<math.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
float x=2;
printf("%d",x); /* used %d instead of %f */
getch();
}

why is it showing the value of x to be 0 ??
Either change your specifier or the data type of x.

This code runs fine.
1
2
3
4
5
6
7
8
9
10
#include <iostream>

int main()
{
	int x = 2;
	printf("%d", x);
	
	std::cin.ignore();
	
}
Last edited on
Topic archived. No new replies allowed.