It is very unlikely it is not there, but can yourself find the file stdio.h on your computer?
If you work in C you really want #include <stdio.h>. Why do you have the line using namespace std?
I cannot find a reason why was that post reported.
Also, you are using std with cstdio.
If you don't include iostream, you should not 'using namespace std'.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <cstdio>
void swap(int *, int *);
int main()
{
int a = 10;
int b = 20;
swap(&a,&b);
printf("a=%d,b=%d",a,b);
return 0;
}
void swap(int * x, int * y) {
int t = *x; // You need to declare 't' as int.
*x = *y;
*y = t;
}
#include <cstdio>
#include <iostream>
// You need to include iostream, to be able to use namespace stdusingnamespace std;
void swapint(int *, int *);
// The combination of iostream and using namespace std create a new swap function.
// You need to change swap to another name. In this example, swapint.
int main()
{
int a = 10;
int b = 20;
swapint(&a,&b);
printf("a=%d,b=%d",a,b);
return 0;
}
voidswapint(int * x, int * y) {
int t = *x; // You need to declare 't' as int.
*x = *y;
*y = t;
}
- I am actually using Linux terminal for the C program.
- and I am new to C so I don't know where to use using namespace std; or not
- anyway can you tell me which IDE is better for C programing on the window platform
- One thing more is that I have compile this code using <cstdio> and neglecting the using namespace std; but I am still getting same i.e
- error: cstdio: No such file or directory
- code is
#include<cstdio>
void swap(int *,int *);
int main()
{
int a=10;
int b=20;
swap(&a,&b);
printf("a=%d,b=%d",a,b);
return 0;
}
void swap(int *x,int *y)
{
int t=*x;
*x=*y;
*y=t;
}
C doesn't have an include file, <cstdio>, nor does it recognise namespaces. All that stuf is C++. You really should be clear on what you want help with.