Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

Point out the errors, if any, in the following program // mixed has some char and some int values */ int char mixed[100] ; main( ) { int a[10], i ; for ( i = 1 ; i <= 10 ; i++ ) { scanf ( "%d", a[i] ) ; printf ( "%d", a[i] ) ; } } main( ) { int size ; scanf ( "%d", &size ) ; int arr[size] ; for ( i = 1 ; i <= size ; i++ ) { scanf ( "%d", arr[i] ) ; printf ( "%d", arr[i] ) ; } } main( ) { int i, a = 2, b = 3 ; int arr[ 2 + 3 ] ; for ( i = 0 ; i < a+b ; i++ ) { scanf ( "%d", &arr[i] ) ; printf ( "\n%d", arr[i] ) ; } } int arr[ ] = { ‘A’, ‘B’, ‘C’, ‘D’ } ; int

OpenStudy (anonymous):

Plz if anyone knows the errors in these programs then answer it :)

OpenStudy (anonymous):

first of all you are using c language rigth , the secound thing is what this programe should do , or just we must set the errors , what i am saying is it a tracing a question or a program you are supposed to do and failed to run ?

OpenStudy (anonymous):

if is it a c language program i may help you , as it full of a lot of errors the first thing if you want to declare a variable that deals with integrs and chars you have to use structures forms not like that : int char mixed[100] ; as you have written .. as sturcures could be defined before the main function other variables are only defined before functions and they became constants

OpenStudy (anonymous):

my answer will only valid for a c language only . so please tell me what we are dealing with here so i could help you

OpenStudy (anonymous):

@faryaICS are u there

OpenStudy (anonymous):

Yes it is simple C language

OpenStudy (anonymous):

I have a paper tomorrow of C language and i had a paper today so i didnt use my PC ,srry :) bt can u help me ?

OpenStudy (e.mccormick):

Look at the loop index. Remember what the index values of a[10] will be? 10 elements, starting at element 0. One thing you can do with this type of questions is toss them into a compiler and see what breaks.

OpenStudy (anonymous):

willl you have answered me too late , if you still stuck around of course i could help you just let me know because i can see you have got a lot of errors right there first of all : you can not declare diffirent types like this int char . it's a syntax error . instead of that we use structures and it's syntex is like : struct student { int name ; float gpa ; int id ;} ; and the in your main programme { student x; /* it's just like int x or other data types but in that case it contains more than 1 data type .*/ student x.id=1210876; . and so on .

OpenStudy (anonymous):

the secound thing is : the indexing of your arrays starts from zero till n-1 . so when i write x[5] . this means that my arrays will start from [0] to [4] .. so in your counter the right expressions is : int a[10], i ; for ( i = 1 ; i <= 9 ; i++ ) or int a[10], i ; for ( i = 1 ; i < 10 ; i++ )

OpenStudy (anonymous):

sorry for that but i should start from the first index which is zero in that case not 0 for(i=0;i<10;<i++)

OpenStudy (anonymous):

thnaks for your help but i guess ,i already made some mistakes in my paper :( but I really appreciate your correct answers :).I just saw them and my paper was on last thursday :(

OpenStudy (anonymous):

well i am too sad for you :( but u didn't replay in the right time so i missed u up . if you want more explanation with c language i can really help you any time :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!