473,385 Members | 2,180 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,385 software developers and data experts.

Returning a value.

Parul Bagadia
188 100+
I m returning a value of pointer of a structure from one function to main; but whenever it comes in main it becomes NULL... i used another pointer in main and equated its value to returning pointer but its still becoming NULL. I also tried removing its initialization from main; but ivvain.
So, what is to be donr to retain its value? Actually i want to use the same value in other function; which m calling from main.
Apr 9 '08 #1
11 1815
Parul Bagadia
188 100+
Here is the code for reference!

Expand|Select|Wrap|Line Numbers
  1. Full code removed per Posting Guidelines' request that only the relevant portion be posted
Apr 9 '08 #2
Dear Parul...

Please specify the from which function you are returning the pointer to main.

Rgds
Jack Aegan
Apr 9 '08 #3
Parul Bagadia
188 100+
From struct dl merge(struct dl *p)function.
Apr 9 '08 #4
Ganon11
3,652 Expert 2GB
You are not returning a pointer, you are returning the dl struct pointed to by p. I'll check your code to see how you're treating the return value, but this might be a point of confusion.
Apr 9 '08 #5
Parul Bagadia
188 100+
I have discarded that return statement..
But now i have a diff. problem, here what i need to do is to print the merged list! If i use pointer z; it points only the last value....i know it travereses the list till end and goes till last value; but it was having links earlier in complete list.....
So, even if i take another pointer to traverse the list; it may come till end and will print nothing!
The two lists which m merging here are sorted..
I tried with making z local as well global;didnt work!; even tried with passing the value of sec which holds second list; but if i have a value from first list which is smallest; second list wont print it.
Although i assign links like that.
Same the case with ref;which holds first list.......; if i pass ref in display function; it wont print the small values of second list.
It's about Doubly Linked List.
Apr 10 '08 #6
Parul Bagadia
188 100+
Here is the code for reference!
void merge merges the two sorted lists; and dismerge print the two sorted lists.
Expand|Select|Wrap|Line Numbers
  1. full code removed per posting guidelines - please review the section that asks for  the relevant section of code only
Apr 10 '08 #7
Parul Bagadia
188 100+
I need to know this a bit early.
Thank you.
Apr 10 '08 #8
hsn
237 100+
i've skimmed through the code but i couldn't see any problems with it. but in line 16 you don't need else break. it will happen by it self if not the statement then go forward.
i need to test your code to find the problem i don't oknow why bytes removed it you were asking for help try to post it again they may not remove it.
let us see the hole code.

see you and good luck

hsn
Apr 10 '08 #9
Parul Bagadia
188 100+
i've skimmed through the code but i couldn't see any problems with it. but in line 16 you don't need else break. it will happen by it self if not the statement then go forward.
i need to test your code to find the problem i don't oknow why bytes removed it you were asking for help try to post it again they may not remove it.
let us see the hole code.

see you and good luck

hsn
Thanx but i have solved it by myself........ without anybody's help.
And i dont know why my code was removed.....
Who cares; i did it..
Apr 13 '08 #10
hsn
237 100+
good for you m8

hope best of luck to you

regards

hsn
Apr 13 '08 #11
SpecialKay
109 100+
Hey,
I read the rules and i though that it was Fine for someone to post full code if they are asking for help.
I thought the rule on the Full code posting was only for the experts, in not giving people the answer to eazy
Apr 14 '08 #12

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

Similar topics

2
by: Mountain Man | last post by:
Hi, I'm having trouble with the foreach function. I'm using it twice inside a user defined function with two different arrays, and in the second instance it's returning the value of the first...
9
by: mjm | last post by:
Folks, Stroustrup indicates that returning by value can be faster than returning by reference but gives no details as to the size of the returned object up to which this holds. My question is...
11
by: JKop | last post by:
AnyClass Blah() { AnyClass poo; return poo; } As we all know, in the above, the compiler is entitled to:
9
by: Thomas Mlynarczyk | last post by:
Hi, It seems to be a generally adopted convention to have a function return FALSE in case of an error. But if a function is supposed to return a boolean anyway, one cannot distinguish anymore...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
8
by: sam | last post by:
i am starting to experiment with recursion, and decided to write a fairly trivial little program which took a float as input, then called a function to halve it recursively until it was less than...
4
by: scparker | last post by:
Hello, We have a stored procedure that does a basic insert of values. I am then able to retrieve the ID number created for this new record. We are currently using ASP.NET 2.0 and use N-Tier...
8
by: Michal Nazarewicz | last post by:
Hi, What does returning 0 from main() mean according to C89/C90 standard? I've found that in C99 it means successful termination (7.20.4.3p5) however as I'm editing book on C at Polish Wikibooks...
1
by: J. Frank Parnell | last post by:
arrrrrg: Condo for rent has 3 price tiers (for different times of the year): value regular premium For every 7 nites they stay, they get 1 free, and that free one should be the cheapest night...
5
by: ctj951 | last post by:
I have a very specific question about a language issue that I was hoping to get an answer to. If you allocate a structure that contains an array as a local variable inside a function and return...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.