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

Another stuct problme

struct b{//elements};

struct b* funcfoo(){
struct b* p={0};
//do something with p
return p;
}
int main(){
struct b*p=//call funcfoo
printf(*%d%s*,p->inte,p->str);
return 0;
}

///////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
SSSSSSEEEEEGMENTATION FAULTTTTT
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//////////////////////////////////////////////
I am sure you know why ? This is a reapeated error I wasn't able to
memorize. It's on others next to me not me anyway, hehe. Thanx

Jul 12 '06 #1
2 1163
Potatoman wrote:
struct b{//elements};

struct b* funcfoo(){
struct b* p={0};
//do something with p
return p;
}
int main(){
struct b*p=//call funcfoo
printf(*%d%s*,p->inte,p->str);
return 0;
}

///////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
SSSSSSEEEEEGMENTATION FAULTTTTT
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//////////////////////////////////////////////
I am sure you know why ? This is a reapeated error I wasn't able to
memorize. It's on others next to me not me anyway, hehe. Thanx
What you've shown us is not compilable code, so it doesn't segfault.

Guessing wildly at a fix, I'd say that someone has tried to dereference
a null pointer. Bad dog. Null biscuit.

--
Chris "at least there are no crumbs" Dollin
"People are part of the design. It's dangerous to forget that." /Star Cops/

Jul 12 '06 #2
On 12 Jul 2006 00:42:51 -0700, "Potatoman" <gu*************@yahoo.com>
wrote:
>struct b{//elements};

struct b* funcfoo(){
struct b* p={0};
//do something with p
It depends on what you do with p. Unless you assign a different value
to p (such as by using malloc), the printf in main will always yield
undefined behavior. In this case, you are lucky that this particular
type of undefined behavior yields a segmentation fault.
return p;
}
int main(){
struct b*p=//call funcfoo
printf(*%d%s*,p->inte,p->str);
return 0;
}

///////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
SSSSSSEEEEEGMENTATION FAULTTTTT
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//////////////////////////////////////////////
I am sure you know why ? This is a reapeated error I wasn't able to
memorize. It's on others next to me not me anyway, hehe. Thanx

Remove del for email
Jul 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Joe | last post by:
I am trying to write a Perlscript to be used with some HTML pages. Here is how it works: 1.. The first HTML page has a form which requests for user input. Then it passes the QUERY_STRING...
2
by: luu duong | last post by:
I know this is probably easy but here is the details. I have an asp page that is not inside a frameset. I want to post data to another asp page that is inside a frameset. So firstpage.asp has...
8
by: Matt | last post by:
I want to submit the form to the server without opening another page. When we do the following, it will submit the form data in myform to the IIS, and open page2.asp. <form name="myform"...
18
by: John Dalberg | last post by:
Hello I have a login form on a page that should post the data to a non Windows server and upon successful authentication, the browser needs to show the secodn url. I did the form post, got...
5
by: Daniel Tan | last post by:
Are there anyway to copy rows of records from one query to another query and then hide the records in source query ? Pls advise. Thanks. Regards, Daniel
3
by: Kathy Burke | last post by:
Hi, I'm tired, so this question may be silly. I have a fairly long sub procedure. Based on one condition, I load another sub with the following: If Session("GRN") = "complete" Then txtScan.Text...
3
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
3
by: Sin Jeong-hun | last post by:
It seems like the Protect() uses the Windows accout information to encrypt data. If I know the user name and the password, can I decrypt it on another PC? If it is not, how about the exported key?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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...

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.