473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Homework help.

I was wondering if someone can help me with my homework. here's the assignment:
a. Write a C program that has a declaration in main() to store the string "What's for lunch?" into an array named message. There should be a function call to restaurant() that accepts the message as an argument named menu and then displays the message using the pointer notation *(menu + i).


b. Modify this restaurant() function to alter the address in message. Use the expression *menu rather than *(menu + i) to retrieve the correct element.

I don't understand how to do this assignment that's why i am askin for help. I don't understand what's in bold, unfortunately that's the majority of the 2nd half of the assignment. so far i have:

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     char *message = "What's for lunch?";
  6.  
  7.     printf("%s\n", message);
  8.  
  9.     system("pause");
  10.     return 0;
  11. }
  12.  
THANKS FOR YOUR TIME!!!!!!
May 28 '07 #1
5 2973
gpraghuram
1,275 Expert 1GB
HI,
You want to alter the address or the value, i am also not able to understand the info told in the requirement 2.
Can u add more inf then people over here can help u with idea.

Thanks
Raghuram
May 28 '07 #2
svlsr2000
181 Expert 100+
I was wondering if someone can help me with my homework. here's the assignment:
a. Write a C program that has a declaration in main() to store the string "What's for lunch?" into an array named message. There should be a function call to restaurant() that accepts the message as an argument named menu and then displays the message using the pointer notation *(menu + i).


b. Modify this restaurant() function to alter the address in message. Use the expression *menu rather than *(menu + i) to retrieve the correct element.

I don't understand how to do this assignment that's why i am askin for help. I don't understand what's in bold, unfortunately that's the majority of the 2nd half of the assignment. so far i have:

#include <stdio.h>

int main()
{
char *message = "What's for lunch?";

printf("%s\n", message);

system("pause");
return 0;
}


THANKS FOR YOUR TIME!!!!!!
I guess you have to have a function like this
restaurant(int menu)

then u should have some menus
menu[][] = "Menu1"
" Menu 2"
" Menu 3"
and so on. then once u give menu u have to print the corresponding menu
May 28 '07 #3
i just emailed my instructor to further clarify the question. The question was copied and pasted from my syllabus. THANKS for your time and help
May 28 '07 #4
kky2k
34
As far i understood about your requirements here is the solution for ur 1st problem

Code removed as per Posting Guidelines
May 29 '07 #5
svlsr2000
181 Expert 100+
As far i understood about your requirements here is the solution for ur 1st problem

Code removed as per Posting Guidelines
Your program may work fine, but giving him the source will prohibit his thinking and world would just loose one good programmer
May 29 '07 #6

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

Similar topics

7
by: tjshadyluver | last post by:
ok i have gotten this damn project almost done but i am frustrated on this one step. getting 18-35 together and 36-50 and so on. here is my code how can i get them combined in one line instead of...
2
by: N3TB1N | last post by:
Let me try again. I could use some help with this assignment, even though my teacher does not grade assignments.but because I need to know this stuff for a test very soon, but haven't been in...
11
by: spawn | last post by:
but I've been struggling with this for far too long and I'm about to start beating my head against the wall. My assignment seemed simple: create a program that will cacluate the running total of...
1
by: mastern200 | last post by:
I need some homework help with an assignment due wed. I need to make a program where in this program calculates the average of a set of test scores. The program will ask the user how many scores...
1
by: itgetsharder | last post by:
Hey, i was wondering if anyone could help me. i have two questions that i cannot complete for a homework assignment: This method should convert its parameter (a string like "3.1415") to the...
8
by: garyrowell | last post by:
I have been at this programme for hours trying to work out what is wrong. Any help would be very much appricated. Here is the breif I received. The program This week you are going to write three...
3
by: alireza6485 | last post by:
I need to write a C# program that asks for a pattern and for each pattern beeps one and goes silence for 1 second. This is my code: for (int i=0;i< pattern; i++) { ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.