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
Advertisement
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
; C array of pointers A pointer is a variable that contains... pointers.   C Pointer to a function C... information through structure pointer.    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 

Design concepts & design patterns Questions

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

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 

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 

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 

IoC Questions

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

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    

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 

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 

Java Beginners

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

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       

Development process Questions

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

Ajax Questions

c#
c#  how to find out the size of the BMP image in C 

CVS Questions

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

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 

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 

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 

Ajax Questions

c#
c#  how to find out the size of the BMP image 

Development process Questions

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

Development process Questions

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

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++  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 

Development process Questions

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

Design concepts & design patterns Questions

C++
C++  Trace the bubble sort using the following integers,which represent the elements in an array. 5,7,3,8,6,7,3 

Java Beginners

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

Java Beginners

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

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 

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 

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 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++  .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 

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 

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 

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 

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 

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++  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 

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 

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 

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 

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    

SQL Question

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

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 

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 

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  

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 

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 

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

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 

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 

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-Tutorials

The JDK Directory Structure
Directory structure of JDK Welcome to Java tutorial series. In this lesson, you will learn about the directory structure of Java Development Kit, JDK. Since... structure. On your screen, you can see the directory structure of JDK as well as JRE 

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 

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.   

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 

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 

Development process Questions

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

General

C Tutorials
 

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

basic c/c++ questions
basic c/c++ questions  Are the Control statements like if(),while() in built functions? if no, why not as they satisfy all the properties of a function 

Java Beginners

basic c/c++ questions
basic c/c++ questions  Are the Control statements like if(),while() in built functions? if no, why not as they satisfy all the properties of a function 

Java-Tutorials

Difference between C++ and Java
runtime optimization C++ uses pointers while java doesn't have pointers... Java and C++ are Object Oriented Programming (OOPs) language. Java is derived from C++ , hence both has many similarities. C++ is considered more 

Java Beginners

C/C++ QUESTIONS
C/C++ QUESTIONS  ??Write a function for finding out the occurences of repeated word from a sentence. This function would return an array of duplicate words. 

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 

Development process Questions

c/c++ - Development process
c/c++  Ive been asked to develop a backgammon game using C language. I don't know which code to use to move checkers and to roll die. I would appreciate to get some help. Thanks 

Development process Questions

c/c++ - Development process
c/c++  Ive been asked to develop a backgammon game using C language. I don't know which code to use to move checkers and to roll die. I would appreciate to get some help. Thanks 

Java Beginners

c c++ - Java Beginners
c c++  Write a Multi-user chat server and client  Hi Friend, Please visit the following link: http://www.roseindia.net/chatserver/index.shtml Hope that it will be helpful for you. Thanks 

Java Beginners

c or c++ - Java Beginners
c or c++  Write a program for a two user chess game(Users must be on different systems)? please send me this source code to my mail id with step by step explanation 

Advertisements Advertisements
 

 

 

DMCA.com