Home Tutorialhelp Comment Structures and Pointers

 
 

Comment

joshua
Structures and Pointers,
April 7, 2010 at 7:42 PM

consider this:
#include <stdio.h>

struct pple {
char* first_name;
char* last_name;
};

int main (void) {
struct pple person, *ptrp;
ptrp = &person;

printf("\nEnter a persons first name:");
scanf("%s", ptrperson->first_name);

printf("\nFirst Name: %s", person.first_name);

return 0;
}


WHY DO I GET A SEGFAULT
View All Comments | View Tutorial
Related Tutorial and Articles
C Tutorials

C Structure Pointer
on pointers to structures. If p is a pointer to a structure and m is a member... C Structure Pointer       This section illustrates you the concept of Structure Pointer in C. You 

C++

C Tutorials
in celsius.   C Structure Pointer This section illustrates you the concept of Structure Pointer in C. You can see in the given....    C Structure example Structures in C 

Blog

Site map - C Tutorials
Structure example | C Structure Pointer | C Temperature Converter | C...; C Tutorials  | Java Tutorials | PHP Tutorials  | Linux...; | XPath Tutorials | HTML Tutorials C Tutorial Section C String Reverse 

Programming Tutorials

C++Tutorials
; The Function Pointer Tutorials Function Pointers provide some... other tutorials, such as C++: Annotations by Frank Brokken and Karel Kubat...; The CPlusPlus Language Tutorial These tutorials explain the C++ language 

Programming Tutorials

Pointer and Structure in C
Description: In this tutorial you will see how pointer is used with structure. This is a very important example because all data-structure program work... the address of object to p *p allow the pointer to access the objects *p.roll is same 

Java Beginners

C Structure
C Structure  Respected sir, Can a structure in C contain a pointer to itself ? if yes means how sir ? plz help me sir 

Design concepts & design patterns Questions

structures
structures  what will be the size in 64 bits of this structure struct{ int i; char c; }node 

C Tutorials

C array of pointers
C array of pointers       In this section, you will learn how to create array of pointers. A pointer is a variable that contains the memory location of another variable 

Programming Tutorials

Pointer in C
operator 3    ->   structure pointer...; inside. The address variable c is 0X3000. And a pointer variable cptr of char data-type. The cptr pointer variable having the address of c variable rather 

C Tutorials

C Structure example
C Structure example       This section illustrates you the concept of structure in C. Structures in C defines the group of contiguous (adjacent) fields, such as records 

IoC Questions

c-language pointer functions
c-language pointer functions  what is the execution process of character pointer functions with example 

Java Tips and Examples

Java vs. C
. For example, expandable arrays, many data structures, etc. In C it would... which cause the most program errors are pointers, pointer... used in C programs anyway. There are no pointer operators (&, *, -> 

Java Tips and Examples

Java Data Structures
Java NotesJava Data Structures Term "Collections". The overall term for Java's data structure facilities is Collections, a term is is an alternative to the more common Data Structures. In addition to describing general data 

Development process Questions

Function pointer in c
Function pointer in c  What is the difference between function call with function pointer and without function pointer(normal function call 

Java Beginners

java pointers - Java Beginners
variable in java So that pointers are not used in java."how it is different from C & C++?Please give an example?  pointr facilitats us to access diectly any address.ok and in c++ if we have any pointer to pointing a private 

Java Beginners

What is a pointer and does Java support pointers?
What is a pointer and does Java support pointers?   Hi, What is a pointer and does Java support pointers? Thanks   Hi, Pointer is a reference handle to a memory location. Improper handling of pointers leads 

Development process Questions

memory span and shrink - pointers
memory span and shrink - pointers  Memory span and shrink as per application requirement and this is one of major advantage of pointer. please explain the above statment with an example with respect to c 

C Tutorials

Array of String using Pointers
of string using pointers in C. The declaration of an array of character pointers is an extremely useful extension to single string pointer declarations... Array of String using Pointers    

Java Tips and Examples

For C++ programmers
, but the name change is intended to show that you can't use them as C++ pointers... Java NotesFor C++ programmers Java inherited many features from C... always start with an upper case character, Methods (called functions in C 

SQL Question

C program - SQL
C program  Thank You . Write some C programs using pointers . Write some C programs using files. Please reply me .   Hi Friend, Please visit the following link: http://www.roseindia.net/c 

C Tutorials

C Pointer to a function
C Pointer to a function       In this section, you will learn how to use 'Pointer'  function in C. C provides a special feature of  pointer to a function 

Programming Tutorials

Introduction to Data Structures
Data Structure in C A memory play a vital role in c because all variable you...() funtion in C. In this tutorial you will learn about Pointer, Linked List... of pointer. A memory can be categories in following segments Text Segment 

Free C books

C and C++ books-page8
C and C++ books-page8       The ODBC from C Tutorial  In this section for example-based C tutorials that introduce you to ODBC API programming in C. Each tutorial contains 

Free Books

C and C++ books-page10
C and C++ books-page10       The programming language C As a programming language, C is rather... or to files. Related data can be stored together in arrays or structures 

Free Books

C and C++ books-page9
; An Introduction  Function Pointer Tutorial Function Pointers provide some...; A Tutorial on Pointers and Arrays in C If you want to be proficient in the writing... knowledge of how to use pointers. Unfortunately, C pointers appear to represent 

Java Beginners

null pointer
null pointer  dear sir , what is mean by null pointer in c 

Free Books

C and C++ books-page13
C and C++ books-page13       Data Structures and Algorithms with Object-Oriented Design Patterns in C++ This book was motivated by my experience in teaching the course 

General

Java for C Developers
Data types have well-defined sizes.    No pointers In C... allows programmers to have their own data structure with less of codes. Unlike C... Java for C Developers       

HTML Questions

pointer
pointer  CONSTRTUCT A STRUCTURE FOR EMPLOYEE RECORD THAT CONTAINS A PERSON'S NAME, AGE, EMPLOYEE AND SALARY.WRITE A STATEMENT THAT DECLARES A VARIABLE empInfo and a pointer emPtr of type EMPLOYEE.then use the pointer to display 

CVS Questions

C++
C++  How can i write this in dev c 

Development process Questions

C++
C++  How can i write this in dev c 

Free Books

C and C++ books-page6
* as its parameter.      The Pointer to C++ Member Function Pointers to Member Functions are one of C++'s more rarely used... C and C++ books-page6       

IoC Questions

C Concepts
C Concepts  respected sir, Can I use a void ** pointer as a parameter so that a function can accept a generic pointer by reference? I have a function extern int f(int *); which accepts a pointer to an int. How can I pass 

Development process Questions

c++
c++  use a prgrm as an example to xplain-: a)class b)object c)message d)cope resolution operator 

Development process Questions

c++
c++  write a programme that calculates the area and circumference of a rectangle 

Java Beginners

c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used 

Java Beginners

c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used 

Java Beginners

c++
c++  i use turbo c++...i want to change the background color...what is the command for it and the header file used 

Development process Questions

C++
C++  dear sir How to create windows form application for login screen using C++? USER Name -TESTADMIN Password -testuser 

Development process Questions

c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples 

Development process Questions

c++
c++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples 

Development process Questions

C++
C++  differenciate btw.-a)local & public variables b)pre-defined & user defined functions c)fnctn prototype,defination & fnctn code.use code examples 

Java Beginners

C++
C++  Describe the principle advantages of deploying a linked list versus a static array when implementing a Queue or a Stack 

Development process Questions

c++
c++  write a prgrm tht accepts 3 integer values,then with a function to swap the values 

Development process Questions

C++
C++  I have been asked to write a programme that gets five values,gets the sum,average and product please help me 

Java Beginners

C#
C#  i need a code that will make program perform the basic operations upon the data Listview save, update and cancel 

IoC Questions

C Language
C Language  Respected Sir, How can I determine the byte offset of a field within a structure? How can I access structure fields by name at run time? please help me sir . Thank you sir 

Java Beginners

C Language
C Language  Respected sir, Why does sizeof report a larger size than I expect for a structure type, as if there were padding at the end? help me sir 

Spring Framework Questions

c++
c++  write a program that gets a key or character from the keyboard and displays it ASII code in decimal, hexadecimal and binary form.It must also give a description of the key pressed 

Development process Questions

c++
c++  write a prgrm tht calculates the surface area of a cylinder.the prgrm shld find the circumfrance and have a function that calculates the fadius and another to calculate the surface area 

Development process Questions

C++
C++  write a prgrm tht gets five values,gets the sum,average &...; #include <conio.h> void main() { clrscr(); int a,b,c,d,e,sum; float average...;>b>>c>>d>>e; sum=a+b+c+d+e; average=sum/5; product=a*b*c*d 

Development process Questions

c++
c++  .write a program that accepts 5 subjects of a student,it should have a function to calculate the average & another function to grade.grade should be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70 

UML Questions

c++
c++  Consider the following function: int funcExercise7(int list[], int size) { int sum = 0; for (int index = 0; index < size; index++) sum = sum + list[index]; return sum 

UML Questions

c++
c++  Consider the following declarations: class xClass { public: void... private members does class xClass have? c. How many constructors does class xClass.... Write a C++ statement that prints the values of the data members of the object 

Development process Questions

C#
C# register form  i want to generate a user id automatically after filling their register form and i want to show their id to their email? please reply me soon 

UML Questions

c++
c++  Consider the following declarations: class xClass { public: void func(); void print() const; xClass (); xClass (int, double); private: int u... private members does class xClass have? c. How many constructors does class xClass 

CVS Questions

c++
c++  Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo... name with the minimum GPA 7) Display Student GPAs as Letter Grades (A, B, C, D 

Development process Questions

c++
c++  .write a prgrm tht accepts 5 subjects of a student,it shld hv a function to calculate the average & another function to grade.grade shld be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70 

UML Questions

c++
c++  Characterize the following algorithm in terms of Big-O notation. Also find the exact number of additions executed by the loop. (Assume that all variables are properly declared.) for (int i = 1; i <= n; i++) sum = sum + i 

UML Questions

c++
c++  Characterize the following algorithm in terms of Big-O notation. for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) for (int k = 1; k <= n; k++) cout << i + j + k 

UML Questions

C++
C++  . Consider the definition of the following class: class CC { public: CC(); //Line 1 CC(int); //Line 2 CC(int, int); //Line 3 CC(double, int); //Line 4 . . . private: int u; double v 

UML Questions

c++
c++  Write the definition of the class dayType that implements the day of the week in a program. The class dayType should store the day... on an object of type dayType: a. Set the day. b. Print the day. c. Return the day 

Free C# books

C and C++ books
In this section for example-based C tutorials that introduce you to ODBC... C and C++ books       Page 1 This is the online version of The C Book, second edition 

Java Beginners

c++
c++   Assume vector "x" of integers with values of 7, 3, 5, 8, 1, 9, 0, 4, 2, 6. Second, assume integer variables "a," "b" and "y" with values of 3, x.size()-5 and 0, respectively. Third, assume a for-loop header which: 3.1 

Development process Questions

c++
c++  write a programme that calculates the area and circumference of a rectangle   #include<conio.h> #include<iostream.h> class rect { int l,b; int area; int peri; public: void get_rect() { cout<<"\n 

IDE Questions

C program
C program  hi, here is my question: Create a structure to specify data on students given below: Roll number, Name,Department, Course, Year... a function to print names of all students who joined in a particular year. (c 

Java Beginners

pointer to a reference
pointer to a reference  pointer to a reference in C++    #include <iostream> using namespace std; void foo1(int& x) { int* p = &x; *p = 123; } void foo2(int* x) { int 

Java Beginners

pointer to a reference
pointer to a reference  pointer to a reference in C++    #include <iostream> using namespace std; void foo1(int& x) { int* p = &x; *p = 123; } void foo2(int* x) { int 

Java Beginners

data structures - Java Beginners
data structures  I have got a project of the subject 'data structures and C++' and the topic is 'types of graphs'. please guide me on this topic and help me finding material of this topic 

Programming Tutorials

C++GraphicsTutorials
C++ Graphics Tutorials     ... in this document is correct. C/C++ Windows programmers who want to learn... MFC.      OpenIL in Dev-C++ OpenIL 

C Tutorials

C Multiple Indirection
Indirection. C permits the pointer to point to another pointer. This creates many layers of pointer and therefore called as multiple indirection. A pointer... C Multiple Indirection    

Tutorials

NSString in objective c
NSString in objective c In this series of Iphone application development tutorials, we going to introduce you with some of the iphone basic classes and objects...that are used in objective C. NSString is one of them. Brief Introduction 

SQL Question

C program - SQL
C program  Write a C program for airport simulation using queue data structures. Please reply me 

Programming Tutorials

Linear and Non-Linear Data Structure in C
Linear Data Structure: Linear data structure is linear if element is adjacent... as its previous and next member. Example of Linear Data Structure Array Linked List Stack Queue Non- Linear Data Structure Non-Linear data 

Development process Questions

C,C++
C,C++  Sir, 100&30 gives output 4 in C++ and 100|30 gives output 116 How & and | gives output 4 and 116 

Development process Questions

C,C++
C,C++  int i=100,j=20; int c=i&j; int r=i|j; printf("%d",c); printf("%d",r);   #include<stdio.h> #include<conio.h> void main(){ int i=100,j=20; int c=i&j; int r=i|j; printf("%d",c); printf("%d",r 

Free C# books

C and C++ books-page3
to structure the system into components. Most of the functions in C++ are members... C and C++ books-page3       C for C++ programmers Before there was C++ there was C 

General

Null Pointer Exception
are same as pointers in C. In C pointer refers to the memory location of variable... Null Pointer Exception        Null pointer exceptions are the most common run time  

Development process Questions

all c library functions
all c library functions  hi dear c coders, i need all c library functions with a detailed explanation. Who can give me usefull link? thanks beforehand!   Hi Friend, Please go through the following link: C Tutorials 

SQL Question

C program - SQL
C program  write a C program to print multiplication table using pointers.  Hi Friend, Try the following code: #include #include void main() { int i,j; int * pt; clrscr(); printf(" "); printf("\n 

Java Interview Questions

about c and java
://www.roseindia.net/c-tutorials/ http://www.roseindia.net/interviewquestions...about c and java   i need java and c language interview and objective questions with answers for the fresher.please provide to me   Please 

Free C++ books

C/C++ Programming Books
C/C++ Programming Books         Visual C++ 6 Unleashed Visual C++ 6 Unleashed provides comprehensive coverage of the core topics 

Java Interview Questions

Pointers - Java Interview Questions
Pointers  Why Pointer are not used in JAVA?  There is no need to store the address of the another variable in java So that pointers are not used in java 

General

Overloading considered Harmful - Java Tutorials
development with C++, he found himself attracted to Java, seeing its simplicity... on pointers which you can find in every Java introduction. The seminal idea... structure. Unlike overriding, overloading cannot just be applied in a server 

Framework Questions

c postfix - Framework
://www.roseindia.net/c-tutorials/index.shtml Thanks...c postfix  q: write a c program to read apostfix expression store it in array of character then evaluate this expression using eval and get_token 

Java Beginners

C Program....PLEASE HELP
C Program....PLEASE HELP  For this assignment, you are to write a program that calculates points along a rhodonea curve, a.k.a. a mathematical rose..., and pointers. I am lost and need a little help starting please *int fillArray 

Java Interview Questions

C interview questions
C interview questions  Plz answer the following questions..... TECHNICAL - C /question number 1/ Code: int z,x=5,y=-10,a=4,b=2...? a. 5 b. 6 c. 10 d. 11 e. 12 /question number 2/ With every use of a memory 

Java Interview Questions

C interview questions
C interview questions  Plz answer the following questions..... TECHNICAL - C /question number 1/ Code: int z,x=5,y=-10,a=4,b=2...? a. 5 b. 6 c. 10 d. 11 e. 12 /question number 2/ With every use of a memory 

C++

Java vs C
Java vs. C Language In this section we will compare Java and C Programming..., solaris etc. It is not necessary to compile the program for each platform. The C... programming language while c is procedural language Platform independence 

Development process Questions

c/c++ - Development process
c/c++  Creating animation using c/c++. The code for moving an object using c/c 

SQL Question

C program - SQL
C program  Thanks!!!!!!!!!! Please reply me some programs for DATA STRUCTURES (LINKED LISTS,ETC)  Hi Friend, Try the following code: # include # include #include struct element *temp; struct 

Java Beginners

Change case in C language
Change case in C language  I want to right in .dat file through structure.For this i have defined following: struct student //structure defination... If user is typing b5678 ,i want to store as B5678. (C)for input i am using 

Development process Questions

c/c++ - Development process
c/c++  I need the code for developping two dice and roll them using c/c++. Thanks 

Java Beginners

variable declaration in c and c++
variable declaration in c and c++  Comparison and an example of variable declaration in C and C 

General

C Tutorials
C       Java...; Java for C Developers Some times ago, many people believed that Java was slower than C because Java had to run through a virtual machine.   

Free C++ books

C and C++ books-page11
C and C++ books-page11       The Industrial Strength of C++ In early 1990, C++ was chosen... by the two of us, working as the C++ support group. Then, in 1991 

Development process Questions

C/C++ - Development process
C/C++  I need the code for playing the backgammon game using C/C++.Im using turbo C. I`ve already design the board.I badly need the code for playing this game 

Java Beginners

null pointer error
null pointer error  Respected sir there is a problem in this code... pointer error sir please help me my code are given below compilatation class...=stmt.executeUpdate(); //cn.commit(); cn.close(); } catch(SQLException c) {} catch 

Java Beginners

null pointer error
null pointer error  Respected sir there is a problem in this code... pointer error sir please help me my code are given below compilatation class...=stmt.executeUpdate(); //cn.commit(); cn.close(); } catch(SQLException c) {} catch 

General

C Tutorials
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.