I
Interrupt
Hi folks, I'm trying to teach myself C, I’m finding it pretty hard
going!! Something’s don’t make sense- for example I’ve written a bit
of code if I declare variable int a; at the start of variable
declarations (in a watch window : the code doesn’t work because int a
=0 always; ) But if I declare it last the code works ie what ever the
user inputs???
************ Code *********************************************
#include <stdio.h>
#include <stdlib.h>
int manipulate(int a,int box,char c);
int main()
{
while(1)
{
// if I declare int a here code doesn’t work???????
char c;
int z;
int box;
int a; // when I declare it here it works ??????
puts("enter an integer b");
scanf("%d",&box);
puts( " the integer value a");
scanf("%d",&a);
puts("Enter the type of manipulation Required,/,*,+,-.");
scanf("%s",&c);
z = manipulate( a, box, c);
printf("the Answer is %d\n\n",z);
}
return 0;
}
************************ Code
**********************************************************************
going!! Something’s don’t make sense- for example I’ve written a bit
of code if I declare variable int a; at the start of variable
declarations (in a watch window : the code doesn’t work because int a
=0 always; ) But if I declare it last the code works ie what ever the
user inputs???
************ Code *********************************************
#include <stdio.h>
#include <stdlib.h>
int manipulate(int a,int box,char c);
int main()
{
while(1)
{
// if I declare int a here code doesn’t work???????
char c;
int z;
int box;
int a; // when I declare it here it works ??????
puts("enter an integer b");
scanf("%d",&box);
puts( " the integer value a");
scanf("%d",&a);
puts("Enter the type of manipulation Required,/,*,+,-.");
scanf("%s",&c);
z = manipulate( a, box, c);
printf("the Answer is %d\n\n",z);
}
return 0;
}
************************ Code
**********************************************************************