473,625 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help needed on C program exection

1 New Member
Hi ,

Can any one calrify me giving answers to the questions based on the c program given below.
Expand|Select|Wrap|Line Numbers
  1. char * b, q, *r;
  2. b=getbuf();
  3. q = *b;
  4. r= anotherfunction(b);
  5. /* we want to use ‘q’ and  ‘r’ here*/
  6. char * getbuf()
  7. {
  8.    char buff[8];
  9. /* unspecified, buff defined here *./
  10.   return (char *) buff;
  11. }
  12.  
1. What will be in variable ‘q’ after line q=*b is executed? Under what conditions might this not be so?



2. Is there an alternative, but equivalent, way to write the line char * getbuf() If so, what is it?



3. Is getbuf() a reasonable function?



4. Will getbuf() execute at all?



5. Please comment on line return (char *) buff;



6. Is getbuf() good practice, and why?



7. What line not given should be provided for compilation?

Please I need help very urgently .

Regards
Sahitya
Nov 15 '07 #1
1 1108
sicarie
4,677 Recognized Expert Moderator Specialist
What did you get when you ran this yourself?
Nov 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

31
14325
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? Basically: "Press any key to continue..." I beleive that I am looking for is something along the lines of a....
2
1180
by: Gungmas | last post by:
When I trace the exection in my program the source code does not correspond to where the code is supposed to execute. When I single step the marker stops on empty lines or rows of comment also so it seems like the debug information has been corrupted in some way. I have tried to rebuild the program but it does not help. I have also not been able to set a breakpoint in a form's load event and get the program to break there, but perhaps this...
28
10256
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when appropriate based on your method names . the GridView has OnRowCommand="GridView1_RowCommand" in the aspx. my problem is that the RowCommand event is firing twice (95% of the time) on the page. the other 5% it only fires once. there's no
4
3403
by: Gary | last post by:
Hi, I have a temperature conversion program down pat, but I was told to add an average, meaning, i need to get the average temperature for as many times as it was entered. i do not know where to start, and my stpid book doesnt seem to help. here is my program #include <iostream.h> void main( ) {
4
2965
by: perryschon | last post by:
Can someone please help me out with the Visual Basic source code needed that allows configuration and usage of comm ports in any PC? I am constructing an asynchronous serial communication RS-232 circuit which will include serial cables (transmitter and receiver) connected from one pc to another pc with a 9-pin null modem in between. The VB program will be used to input the data and the output will appear on the remote PC. I need help in...
9
2076
by: smartbei | last post by:
Hello, I am a newbie with python, though I am having a lot of fun using it. Here is one of the excersizes I am trying to complete: the program is supposed to find the coin combination so that with 10 coins you can reach a certain amoung, taken as a parameter. Here is the current program: coins = (100,10,5,1,0.5) anslist = def bar(fin, hist = {100:0,10:0,5:0,1:0,0.5:0}): s = sum(x*hist for x in hist)
2
1646
by: mia23 | last post by:
Hello, I am a java beginner and I need series help in solving this program; my assignment is due after 2 days and I can't understand this program . This is THE PROGRAM:  The ABC medical clinic needs your help in building a Java application that can help in keeping track of patients, appointments, and clinic activities.  Create a class Patient from which we can create objects to handle information about different patients. Each patient is...
0
1163
by: boyindie86 | last post by:
Hi Forum, I am having some really iritating problems with an simple input page which should pass parameters into a stored procedure from the text boxes first and last name. I keep getting the error during exection of sp_myinsert, pfirstname not defined, every time i try to submit the form Has anyone got any suggestions I have giving my code for procedure and page many thanks boy
1
1414
by: boyindie86 | last post by:
Hi Forum, I am having some really iritating problems with an simple input page which should pass parameters into a stored procedure from the text boxes first and last name. I keep getting the error during exection of sp_myinsert, pfirstname not defined, every time i try to submit the form Has anyone got any suggestions I have giving my code for procedure and page many thanks boy
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7184
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.