freelanceprogrammers.org Forum Index » C

doubts in c


View user's profile Post To page top
sudarsan_amar Posted: Thu Jul 10, 2003 7:51 pm


Joined: 10 Jul 2003

Posts: 2
doubts in c
sir,
       i am sudarsan completed my B.E(CSE)  in 2003 just recently.
i am searching for jobs. iam sending some questions in c.please  reply to this questions.
                                                                         with regards ,
                                                                          sudarsan.
SMS using the Yahoo! Messenger;

Download latest version.
Reply with quote
Send private message
View user's profile Post To page top
kishorehelp Posted: Thu Jul 10, 2003 8:37 pm


Joined: 10 Jul 2003

Posts: 1
doubts in c
hello friends
this is kishore,i am sending link to get all previous papers
 
anirban.bravepages.com/ppapers.html
 
bye
kishore, can be believed for ever
 
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
Reply with quote
Send private message
View user's profile Post To page top
tvmanikandan Posted: Fri Jul 11, 2003 10:12 am


Joined: 18 Jul 2003

Posts: 2
doubts in c
I have worked in G++ in Unix.

#include<stdio.h>
#define cube(x)(x*x*x)
main()
{
int i=3;j;
j=cube(i++);
printf("%d%d",i,j)
}

what will be the o/p : 4 27

main()
{
int *i,j=7;
i=(int*)malloc(sizeof(++j));
printf("%d",j);
}
what will be the o/p : 7

I don`t get the reason behind the outputs





______________________________ Reply Separator _________________________________
Subject: [Programmers-Town] doubts in c
Author: sudarsan.amar (sudarsan_amar@...) at internet
Date: 7/10/03 8:21 PM


#include<stdio.h>
#define cube(x)(x*x*x)
main()
{
int i=3;j;
j=cube(i++);
printf("%d%d",i,j)
}
what will be the o/p?
main()
{
int *i,j=7;
i=(int*)malloc(sizeof(++j));
printf("%d",j);
}
what will be the o/p?
Reply with quote
Send private message
View user's profile Post To page top
c_mallircr Posted: Fri Jul 11, 2003 3:07 pm


Joined: 11 Jul 2003

Posts: 2
doubts in c
Hi, if u compile this program with -E option, i.e., gcc -E <this file name> u will see the pre-processor expansion like this. main() { int i=3, j;
j = (i++ * i++ * i++);  // Here the increment operator won`t incremnt for each i++ after completing this statement it will increment by thrice. So i will be 3 + 3 after this statement. j = 3 * 3 * 3;
printf("%d%d", i,,j);} Rgds,
Malli
--- tv.manikandan@... wrote: --------------------------------- I have worked in G++ in Unix. #include<stdio.h> #define cube(x)(x*x*x) main() { int i=3;j; j=cube(i++); printf("%d%d",i,j) } what will be the o/p : 4 27 main() { int *i,j=7; i=(int*)malloc(sizeof(++j)); printf("%d",j); } what will be the o/p : 7 I don`t get the reason behind the outputs ______________________________ Reply Separator _________________________________ Subject: [Programmers-Town] doubts in c Author: sudarsan.amar (sudarsan_amar@...) at internet Date: 7/10/03 8:21 PM #include<stdio.h> #define cube(x)(x*x*x) main() { int i=3;j; j=cube(i++); printf("%d%d",i,j) } what will be the o/p? main() { int *i,j=7; i=(int*)malloc(sizeof(++j)); printf("%d",j); } what will be the o/p?
Yahoo! Groups Sponsor ADVERTISEMENT To unsubscribe from this group, send an email to: Programmers-Town-unsubscribe@yahoogroups.com Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. Mallikarjuna CSoftware EngineerMindTree Consulting Pvt. Ltd.BangalorePh: 671 1777 / 671 2777 Extn 1514
SMS using the Yahoo! Messenger;

Download latest version.
Reply with quote
Send private message
View user's profile Post To page top
sudarsan_amar Posted: Fri Jul 11, 2003 6:31 pm


Joined: 10 Jul 2003

Posts: 2
doubts in c
sorry your output is wrong for first question.tv.manikandan@... wrote:
     I have worked in G++ in Unix.          #include<stdio.h>     #define cube(x)(x*x*x)     main()     {     int i=3;j;     j=cube(i++);     printf("%d%d",i,j)     }          what will be the o/p : 4 27          main()     {     int *i,j=7;     i=(int*)malloc(sizeof(++j));     printf("%d",j);     }     what will be the o/p : 7I don`t get         the reason behind the
outputs______________________________ Reply Separator _________________________________Subject: [Programmers-Town] doubts in cAuthor:  sudarsan.amar (sudarsan_amar@...) at internetDate:    7/10/03 8:21 PM#include<stdio.h>#define cube(x)(x*x*x)main(){int i=3;j;j=cube(i++);printf("%d%d",i,j)}what will be the o/p?main(){int *i,j=7;i=(int*)malloc(sizeof(++j));printf("%d",j);}what will be the o/p?To unsubscribe from this group, send an email to:Programmers-Town-unsubscribe@yahoogroups.comYour use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
SMS using the Yahoo! Messenger;

Download latest version.
Reply with quote
Send private message
View user's profile Post To page top
amitsoni29 Posted: Sat Jul 26, 2003 3:22 pm


Joined: 26 Jul 2003

Posts: 1
doubts in c
--- In Programmers-Town@yahoogroups.com, tv.manikandan@s... wrote:
> I have worked in G++ in Unix.
>
> #include<stdio.h>
> #define cube(x)(x*x*x)
> main()
> {
> int i=3;j;
> j=cube(i++);
> printf("%d%d",i,j)
> }
>
> what will be the o/p : 4 27
For these type of questions, Dennis Ritchie says that these are very
much compiler depended and hence are not the logical questions to be
asked. These type of programs have no standard output and may produce
different results on different platforms.

--
Amit.

>
> main()
> {
> int *i,j=7;
> i=(int*)malloc(sizeof(++j));
> printf("%d",j);
> }
> what will be the o/p : 7
>
> I don`t get the reason behind the outputs
>
>
>
>
>
> ______________________________ Reply Separator
_________________________________
> Subject: [Programmers-Town] doubts in c
> Author: sudarsan.amar (sudarsan_amar@y...) at internet
> Date: 7/10/03 8:21 PM
>
>
> #include<stdio.h>
> #define cube(x)(x*x*x)
> main()
> {
> int i=3;j;
> j=cube(i++);
> printf("%d%d",i,j)
> }
> what will be the o/p?
> main()
> {
> int *i,j=7;
> i=(int*)malloc(sizeof(++j));
> printf("%d",j);
> }
> what will be the o/p?
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help