GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  L&T infotech
Next Question 
 L&T infotech  |  Question 1 of 7    Print  
eg.for a program that can be done in C but not in C++?

  
Total Answers and Comments: 6 Last Update: August 30, 2007     Asked by: sreekanth p s 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 29, 2006 10:28:24   #1  
srinivas        

RE: eg.for a program that can be done in C but not in ...
I think sorting can be done in C( eg: quick sort merge sort binary tree sort...) and not in C++.
 
Is this answer useful? Yes | No
September 10, 2006 13:21:52   #2  
swapnil gupta        

RE: eg.for a program that can be done in C but not in ...

hi

please send me the answer of that question.

THANK YOU!


 
Is this answer useful? Yes | No
September 20, 2006 02:15:47   #3  
Saurabh Shankar        

RE: eg.for a program that can be done in C but not in ...

A classic example for a program that can be written in C and not in C++ is creating a mutlithreaded program with POSIX Thread. The POSIX thread functions have been defined in such a way that it cannot be acessed as a member function of an object. If it is required to create a thread of a memeber function of an object in C++ the only way to resolve it is create a thread of a C function which in turn calls the member of function of the desired object.

E.g.

class xyz

{

private:

// all variables defined here

public:

void newthreadfunction(void Param);

};

xyz someobject; // creating a global object of class xyz

// the C function which will be created as a new thread which will access the memeber function of the object

void *NewThread(void *Parameter)

{

someobject.newthreadfunction((void)Parameter); //call of the function

}

void main()

{

pthread_t Thread;

int ThreadCreated;

ThreadCreated pthread_create(&Thread NewThread (void*)3);

}


 
Is this answer useful? Yes | No
April 16, 2007 06:09:47   #4  
Neeru        

RE: eg.for a program that can be done in C but not in ...
Sorting is also performed in C++ Also.Multithreaded is the right answer that we implement it on C but not in C++

 
Is this answer useful? Yes | No
July 07, 2007 06:23:13   #5  
viswakrishnan_m        

RE: eg.for a program that can be done in C but not in ...
TSR( Terminate Stay Routine) programs only can run with the extension of c not cpp
 
Is this answer useful? Yes | No
August 30, 2007 07:09:47   #6  
s.prabhat        

RE: eg.for a program that can be done in C but not in ...
its very simple to answer


eg:---


main()
{
int class y;
class 8;
y class++;
printf( d y);
getch();

}

u can't run this program in c++ because class is a keyword so it'll give the error

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
Related Categories
Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape