473,399 Members | 2,774 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,399 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 2422
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
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,...

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.