arunks
Hey here is the aks
i wrote a program which is given below
but when i run it after asking three values name then deptt then idcode then it gives the following error
plz see why this is so.. and make my program error free
if u want then run it in C and see urself when error comes
PROGRAM2 : another program i have writeen is also not showing ouput as expected..
it doesnt print value of chr.
why is it so and plz correct it
Code:
#include<stdio.h>
#include<conio.h>
struct employee
{
char name[5];
char deptt[5];
int idcode;
float s;
};
void main()
{
struct employee emp[2];
int i,j;
clrscr();
for(i=0;i<2;i++)
{
gets(emp[i].name);
gets(emp[i].deptt);
scanf("%d",&emp[i].idcode);
scanf("%f",&emp[i].s);
}
getch();
}
but when i run it after asking three values name then deptt then idcode then it gives the following error
Code:
scanf: floating point formats not linked
abnormal program termination
plz see why this is so.. and make my program error free
if u want then run it in C and see urself when error comes
PROGRAM2 : another program i have writeen is also not showing ouput as expected..
Code:
#include <stdio.h>
#include <conio.h>
struct test ** display(struct test*); //function prototype
//structure delaration starts here
struct test
{
int cnt;
int chr;
};
void main(void)
{
struct test tst,**tt;
clrscr();
tt=display(&tst);
printf("cnt: %d \n ", (*tt)->cnt);
printf("chr: %c \n ", (*tt)->chr);
getch();
}
struct test ** display(struct test *ptr)
{
ptr->cnt = 1;
ptr->chr = 'a';
return(&ptr);
}
it doesnt print value of chr.
why is it so and plz correct it
Last edited: