| | |
Pls help me with this Struct function
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
•
•
I have seen "good advices" to read stdin char by char until '\n' or EOF occured. I think, it's a bad idea: there are situations when user/program dialog hangs.
ssharish
Last edited by ssharish2005; Sep 28th, 2008 at 8:20 pm.
"Any fool can know, point is to understand"
•
•
•
•
Thanks very much for ur helps but sorry ... I don't get what u mean. I m just a beginner. Here I removed function and tested, it run, compiled but error with result.
What should I do? Thanks anyway.
c Syntax (Toggle Plain Text)
#include <stdio.h> int main( ) { struct student { char name; char dep; char course; int roll; int year; }; struct student d2[3]; int i; printf("Enter Roll Number,Name, Department, Course, Year of Joining\n"); for (i=0;i<=2;i++){ scanf("%d %c %c %c %d",&d2[i].roll,&d2[i].name,&d2[i].dep,&d2[i].course,&d2[i].year); } for (i=0;i<=2;i++) printf("\nRoll Number:%d Name:%c Department:%c Course:%c Year of Joining:%d",d2[i].roll,d2[i].name,d2[i].dep,d2[i].course,d2[i].year); return 0; }
regards,
Ahamed.
Ahamed.
•
•
Join Date: Sep 2008
Posts: 3
Reputation:
Solved Threads: 0
you just have to make following change in your structure.....your progam will surely run....
you can use "getch();" to make output wait till you press any key...
it is included in <conio.h>
hope it will work....
you can use "getch();" to make output wait till you press any key...
it is included in <conio.h>
hope it will work....
C Syntax (Toggle Plain Text)
struct student { char name[10]; char dep[10]; char course[10]; int roll; int year; };
Last edited by abhijeetcn; Oct 6th, 2008 at 5:36 am.
![]() |
Similar Threads
- need help in C (C)
- Self documentation (C++)
- NEED help pls. about linked list (C++)
- help me pls!!!some of my functions doesn't work! (C)
- Pls help me ;'=' : 'unsigned char ' differs in levels of indirection from 'void *' (C++)
- opcode and instructions in bits (C++)
Other Threads in the C Forum
- Previous Thread: comparing a function with library power
- Next Thread: Problem related to c in looping
| Thread Tools | Search this Thread |
Tag cloud for C
* adobe api append array arrays bash binarysearch centimeter char character cm copyanyfile copypdffile createcopyoffile createprocess() csyntax directory dynamic execv feet fgets file floatingpointvalidation fork frequency function getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux highest homework i/o ide infiniteloop initialization interest intmain() keyboard kilometer lazy license linked linkedlist linux linuxsegmentationfault list match matrix meter microsoft mqqueue multi mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scheduling segmentationfault send shape single socketprogramming spoonfeeding stack standard strchr string strings student suggestions system test testautomation unix urboc user whythiscodecausesegmentationfault win32api windows.h





