210 Topics

Member Avatar for
Member Avatar for n1csaf3

I am having some difficulty's locating an issue within some code I am working on. It breaks when it runs the "if (AIwords->name == NULL)" // This is the struct which is located in the header(.h) struct AIstruc_word { char *name; bool controlStatement; struct AIstruc_word *next; }; // This is …

Member Avatar for ravenous
0
147
Member Avatar for jesskavidja

Hey there, I'm having issues with a custom string tokenizer I'm using for an assignment. I've looked around and haven't managed to find anything that really answers my question, so here goes nothing. Whenever I run the program and it runs the tokenizer, I get a seg fault. I'm fairly …

Member Avatar for Sokurenko
0
282
Member Avatar for dancks

So, I'm using allegro game programming library. Before I move on to bigger and better things I wnat to get a handle on pointers. Specifically with things like structs, linked lists and maybe binary trees in the future. I posted a program that uses a linked list to keep tracks …

Member Avatar for dancks
0
301
Member Avatar for Lord_Migit

Hi there. I am having some trouble trying to figure out how to delete a pointer that is held in a vector. int main() { vector<Test*> iVector1; vector<Test*> iVector2; vector<Test*>* pVec1(&iVector1); vector<Test*>* pVec2(&iVector2); pVec1->push_back(new Test(11)); pVec1->push_back(new Test(12)); pVec2->push_back(new Test(23)); pVec2->push_back(new Test(24)); //delete iVector1.at(0); delete iVector1[0]; iVector1.at(0) = new Test(21); pVec1->at(1) …

Member Avatar for Lord_Migit
0
248
Member Avatar for hwoarang69

warning: int format, pointer arg (arg 2) i have no pointers this function :( main.. functions.... functions. int test(char num) { int total[SIZE]; printf("%d",total); fflush(stdout); //no pointers return 0; }

Member Avatar for deceptikon
0
231
Member Avatar for Mopikope

I am having a problem with an address book program. The problem is that when I try to set the fnTextField, lNTextField, ...etc I get null in all the JTextEdits. I've went through the debugger and before the I called `Edit edit = new Edit(1)` the values are in the …

Member Avatar for Mopikope
0
152
Member Avatar for LateNightCoder

Basically i have made a binary class that inherits from a matrix class. and aparantly when i make the binary image the deconstructor doesn't work properly. the program runs, reads in the files and makes the binary matrix. However when the binary deconstructor and matrix deconstructors are called, the program …

Member Avatar for LateNightCoder
0
230
Member Avatar for hwoarang69

how to copy pointer to pointer. char *name1; //store the value of DAVE char *name2; if name2 was a array i would have done. strcpy(name2,name1); but i dont know how to copy pointer into pointer. i was thinking some thing like this. name2 = name1? also do i need to …

Member Avatar for Shardendu
0
162
Member Avatar for straylight

I am having some problems working with the tell method when working with a file. Basically what I am trying to do is use the tell method to find where I currently am within a paragraph and to only display the characters up to a certain tell count. For example: …

Member Avatar for TrustyTony
0
282
Member Avatar for hwoarang69

*i am trying to copy the value of ar2[10] //in main. has the value 1,2,3,4,5 in ar[10] //(in struct node). empty array so to copy the value iam not sure if i could use a strcpy for ex, strcpy(head->ar, ar2); //here is my code struct node { int ar[10]; //empty …

Member Avatar for hwoarang69
0
146
Member Avatar for hwoarang69

trying to copy pointer in array. lets say *pointer has the value "COMPUTER". and i want to store in array[o]; note: i want to use strcat to do this and i do not want to do some thing like "array[0]" char test[10]; char *point; //has the value "COMPUTER" for(int i …

Member Avatar for Vish0203
0
180
Member Avatar for N1GHTS

I am importing some C code into a C++ compiler, specifically Borland C++ Builder 5. I seem to have a problem with this style of code: // A structure that contain's itself typedef struct AnObject AnObject; struct AnObject { AnObject *Object; }; // A global structure to store a pointer …

Member Avatar for N1GHTS
0
236
Member Avatar for Shifter12345

Hello! I started learning C++ and I just discovered pointers. Well, it's a little bit hard for me to understand what's the point of it so I'll just explain my problem. I want to create a code in which I compute results using arithmetic operations (+, -, ÷, ×,%, ^ …

Member Avatar for devninja
0
185
Member Avatar for chaoz014

Im having a lot of trouble figuring out whta's wrong in my code... it compiles and everything but every time I try to run the program it crashes before even starting and displays the following message: Debug Assertion Failed! Program: c:\CIS 278\MyString\Debug\MyString.exe File: f:\\dd\vctools\crt_bld\self_x86\crt\src\dbgdel.cpp Line: 52 Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) For information.......... …

Member Avatar for deceptikon
0
1K
Member Avatar for hwoarang69

i want to create array of pointer. "aa" "ab" "ac" i tried many thing but it still give me error. char *table[3] = "aa", "ab", "ac"; or char *table[3]; *table[0] = "aa"; *table[1] = "ab"; *table[2] = "ac";

Member Avatar for hwoarang69
0
166
Member Avatar for initialfresh

If anyone can help me finish this and point out what had to be done to make the program work, that would be great. -ask for how many days user wants to enter from 1-365 (validate) -ask for temperature for each days between -60 and 90 degrees celsius (loop, validate) …

Member Avatar for Lerner
0
184
Member Avatar for DJXiej

Here's a small snippet from my code. Following a Knuth Shuffle model in the Shuffle function, I get 6 Pointer Expected errors in line 15, but I'm sure its really 2 due to the SWAP function in the header. Now the two things I'm swapping are a random index and …

Member Avatar for histrungalot
0
441
Member Avatar for cahitburak

Hi all. I am trying to build a Binary Linked Trie but fail in basic pointer operations.Following code can be built but in debug or run mode, it breaks and outputs the error. [ICODE]typedef struct node { char ch; node *next; }; struct node *root = NULL; void add(struct node …

Member Avatar for cahitburak
0
942
Member Avatar for luislupe

I programmed some functions that use a dynamic array of [CODE=c] double ** array [/CODE]. But know, I want to test the results with a small array of 5 x 5 elements and use this array in the functions I coded. My problem is that I can find no way …

Member Avatar for luislupe
0
242
Member Avatar for linkingeek

Could you please tell pictorially difference bw these 2 codes(o/p is same) and suggest any source where i can once in for all resolve doubts in pointer to pointer problems except "K&R in ANSI C" [CODE]#include <stdio.h> #include <string.h> void pointer(char**); void main() { char *p[]={"name","fame","claim"}; pointer(p); } void pointer(char …

Member Avatar for versan
0
149
Member Avatar for nik2012

Hello. I am learning C++, and I am a little stuck. Right now, I'm working on pointers. The problem I'm working on requires sorting an array of structures, using pointers instead of array indices, using a selection sort. My code is not working, and I can't quite figure out why. …

Member Avatar for nik2012
0
1K
Member Avatar for matt209

I'm new to using vectors and some may see this as a trivial problem. If you have any suggestion on how I can improve the program, I welcome your input. code(with problem): [CODE] #ifndef CMONOPOLY_HPP #define CMONOPOLY_HPP #include <vector> #include "head.hpp" namespace CMonopoly { class CMonopoly { public: ~CMonopoly(); void …

Member Avatar for matt209
0
629
Member Avatar for Graphix

Hi, I've been trying to learn what pointers are and how they function, and I now finally understand most of it. However, I don't understand the assignment of strings to a char *, and what the values they have mean. I wrote a small program to learn: [CODE]#include <stdio.h> #include …

Member Avatar for Graphix
0
170
Member Avatar for engineerchica

Hi all, My code for a function to count words is posted below, and the only error that appears when I build it in my compiler is that char present is uninitialized. My program will not run with this uninitialized value. I've been searching for info on how to initialize …

Member Avatar for engineerchica
0
457
Member Avatar for borchu

Hello, I am asking about true syntax of the following:: I have a class name P and in header file (of this class) ------> [CODE] class P { public: P(); ~P(); void addItem(const int newItem); void deleteItem(const int Item); void showAll(); /** need to proper getter funct. of tail */ …

Member Avatar for borchu
0
236
Member Avatar for Karlwakim

Hi everybody, i am new to c++ and wanna know why pointers are useful ? Why would i use them ? For what ? THANKS

Member Avatar for rubberman
0
160
Member Avatar for epicbeast9022

Hello everybody I [I]thought[/I] I understood inheritance but it turns out I don't. I am creating an SDL/OpenGL mini-GUI library. I have a master class, GUIComponent, with subclasses such as TextLabel under it. I have a vector called guiList that is initialized as [ICODE]std::vector<GUIUnit*> guiList[/ICODE] (it's extern'd and initialized elsewhere; …

Member Avatar for vijayan121
0
172
Member Avatar for johnnyboy567890

Hello, I am trying to store data within a char in C. Different types of data will be used, for example, strings and integers. I have tried the following code: [code]char rawdata[4] = {0xfe, 0x01, 0x99, 0x42}; unsigned int *test = (unsigned int*) rawdata; printf("%u\r\n", *test);[/code] However, it returns the …

Member Avatar for Ancient Dragon
0
94
Member Avatar for LateNightCoder

In my program I read in a text file an decrypt the text from an array. once decrypted i then have to do through it again and search for every tenth array member and show their memory location. The code so far: [CODE] int main( ) { int* pCrypted = …

Member Avatar for LateNightCoder
0
292
Member Avatar for jeevsmyd

class vector { int *v; int size; vector ( int m ) { v=new int[size=m]; for(int i=0;i<size;i++) v[i]=0; } vector( int *a) { for(int i=0;i<size;i++) v[i]=a[i]; } }; int main() { int x[3]={1,2,3}; vector v1(3); vector v2(3); v1=x; v2=y; return 0; } My doubt is , how can the constructor …

Member Avatar for Ancient Dragon
0
115

The End.