473,224 Members | 1,347 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,224 software developers and data experts.

malloc function.

hi
send me solution of this asignment

Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which multiply numbers and draw a table in the following format?

Hint: User enters 3 then program allocates equal to 9 integer memories.

Output:1

Enter a single digit number:
2
The multiplication table of 2 is:
1 2
----------------
1| 1 2
2| 2 4

Output:2

Enter a single digit number:
4
The multiplication table of 4 is:
1 2 3 4
--------------------------------
1| 1 2 3 4
2| 2 4 6 8
3| 3 6 9 12
4| 4 8 12 16
Jun 6 '07 #1
18 2407
I must say that's a useful hint!!
Jun 6 '07 #2
Silent1Mezzo
208 100+
hi
send me solution of this asignment

Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which multiply numbers and draw a table in the following format?

Hint: User enters 3 then program allocates equal to 9 integer memories.

Output:1

Enter a single digit number:
2
The multiplication table of 2 is:
1 2
----------------
1| 1 2
2| 2 4

Output:2

Enter a single digit number:
4
The multiplication table of 4 is:
1 2 3 4
--------------------------------
1| 1 2 3 4
2| 2 4 6 8
3| 3 6 9 12
4| 4 8 12 16

We don't just give you the solution...Thats why people fail out of computer science courses. If you'd work on it yourself and then bring to us your questions we could help you then.
Jun 6 '07 #3
AdrianH
1,251 Expert 1GB
We don't just give you the solution...Thats why people fail out of computer science courses. If you'd work on it yourself and then bring to us your questions we could help you then.
No, that is how you give a school a bad rap. ;)

You get some looser saying that they have got a degree or certificate in something, they get hired and the moron can't do anything. The company then fires the idiot, black lists him/her and the school from within the company and all other companies they know.

But HIRA HAMEED isnít one of those. S/he is one to do the work and post a question when s/he gets stuck. RIGHT?


Adrian
Jun 6 '07 #4
Savage
1,764 Expert 1GB
hi
send me solution of this asignment

Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which multiply numbers and draw a table in the following format?

Hint: User enters 3 then program allocates equal to 9 integer memories.

Output:1

Enter a single digit number:
2
The multiplication table of 2 is:
1 2
----------------
1| 1 2
2| 2 4

Output:2

Enter a single digit number:
4
The multiplication table of 4 is:
1 2 3 4
--------------------------------
1| 1 2 3 4
2| 2 4 6 8
3| 3 6 9 12
4| 4 8 12 16
Don't be so rude,give OP a full solution.

Here ,u go.

Now make sure that u understand it.OK?
Savage
Jun 6 '07 #5
ilikepython
844 Expert 512MB
Don't be so rude,give OP a full solution.

Here ,u go.

Now make sure that u understand it.OK?
Savage
Oh come on, that is being rude!
Jun 6 '07 #6
AdrianH
1,251 Expert 1GB
Oh come on, that is being rude!
I'm on the fence on that one.


Adrian
Jun 6 '07 #7
Silent1Mezzo
208 100+
I'm on the fence on that one.


Adrian
Agreed, while it's not the nicest approach, people that don't read the rules really do need to be told
Jun 6 '07 #8
ilikepython
844 Expert 512MB
Agreed, while it's not the nicest approach, people that don't read the rules really do need to be told
I was only joking and that's a good point. Almost every day there at least 2 or 3 new threads going like this:

Problem plzplzplz due tom

<assignment copied and pasted>

plzplzplz its really urgent
Jun 6 '07 #9
Savage
1,764 Expert 1GB
I was only joking and that's a good point. Almost every day there at least 2 or 3 new threads going like this:

Problem plzplzplz due tom

<assignment copied and pasted>

plzplzplz its really urgent
Yea,is it possibly ,when new user is registering, to put on a posting guidelines like one of condtions to join the site?

Savage
Jun 6 '07 #10
Silent1Mezzo
208 100+
Yea,is it possibly ,when new user is registering, to put on a posting guidelines like one of condtions to join the site?

Savage
You mean the conditions that you just press the "Accept Checkbox" without ever looking at?
Jun 6 '07 #11
AdrianH
1,251 Expert 1GB
Yea,is it possibly ,when new user is registering, to put on a posting guidelines like one of condtions to join the site?

Savage
Post it in the Feedback forum.


Adrian
Jun 6 '07 #12
Savage
1,764 Expert 1GB
Post it in the Feedback forum.


Adrian
Good idea,thanks..

Savage
Jun 6 '07 #13
Savage
1,764 Expert 1GB
You mean the conditions that you just press the "Accept Checkbox" without ever looking at?
No,I mean condition which must be readed.It should be maded so that user can countinue registration only if he has scrolled to the bottom of the posting guidelines and if atleast 10 minutes have passed.

Savage
Jun 6 '07 #14
Silent1Mezzo
208 100+
No,I mean condition which must be readed.It should be maded so that user can countinue registration only if he has scrolled to the bottom of the posting guidelines and if atleast 10 minutes have passed.

Savage
Haha 10 minutes...and the site registration would plummet to zero :P People would just think the site freezed up.
Jun 7 '07 #15
Savage
1,764 Expert 1GB
Haha 10 minutes...and the site registration would plummet to zero :P People would just think the site freezed up.
hahah,then we write with big bold characters:

"The site is not frozen.Plese read posting guidelines to continue.U have 10 minutes left"

Savage
Jun 7 '07 #16
AdrianH
1,251 Expert 1GB
hahah,then we write with big bold characters:

"The site is not frozen.Plese read posting guidelines to continue.U have 10 minutes left"

Savage
What if they are a speed reader? :D


Adrian
Jun 7 '07 #17
Savage
1,764 Expert 1GB
What if they are a speed reader? :D


Adrian
Allready answered in Feedback forum..

Savage
Jun 7 '07 #18
pbmods
5,821 Expert 4TB
Erm... getting back OT....
Jun 7 '07 #19

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

Similar topics

14
by: Joseph | last post by:
I am trying to create a function that allocates memory for the matrix through a function; like the code below. However, this does not seem to work since I believe that the scope of the memory...
34
by: Richard Hunt | last post by:
I'm sorry for asking such a silly question, but I can't quite get my head around malloc. Using gcc I have always programmed in a lax C/C++ hybrid (which I suppose is actually c++). But I have...
231
by: Brian Blais | last post by:
Hello, I saw on a couple of recent posts people saying that casting the return value of malloc is bad, like: d=(double *) malloc(50*sizeof(double)); why is this bad? I had always thought...
7
by: Rano | last post by:
/* Hello, I've got some troubles with a stupid program... In fact, I just start with the C language and sometime I don't understand how I really have to use malloc. I've readden the FAQ...
20
by: spasmous | last post by:
main() { float * f; initialize_f(f); // ...use f for processing free(f); }
6
by: lovecreatesbeauty | last post by:
Hello experts, 1. Does C guarantee the data layout of the memory allocated by malloc function on the heap. I mean, for example, if I allocate a array of 100 elements of structure, can I always...
68
by: James Dow Allen | last post by:
The gcc compiler treats malloc() specially! I have no particular question, but it might be fun to hear from anyone who knows about gcc's special behavior. Some may find this post interesting;...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
71
by: desktop | last post by:
I have read in Bjarne Stroustrup that using malloc and free should be avoided in C++ because they deal with uninitialized memory and one should instead use new and delete. But why is that a...
10
by: somenath | last post by:
Hi All, I have one question regarding return value cast of malloc. I learned that we should not cast the return value of malloc because it is bug hider. But my question is as mentioned...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.