81 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for montjoile

hi there, I'm coding in windows, c++, but when I traslate my code to ubuntu, g++, I get this error: [B]lvalue required as left operand of assigment[/B] This is the line where I get the error: [COLOR="Red"][/COLOR][CODE]&*raiz=&*p;[/CODE] What could be the problem? *raiz and *p are pointers to an avl …

Member Avatar for Tushar_4
0
2K
Member Avatar for manaila

I have been struggling with this for two days now, with no luck. I have a **C** `char` array `char myArray[] = "Hello World";` I also have a pointer to pointer to *char* `char **ptr;` So I want to somehow store `myArray` to `ptr` or somehow convert `myArray`into pointer to …

Member Avatar for jacks009
0
313
Member Avatar for sirlink99

Hello All, I am having trouble looping through a 2D array in C++ (should be very easy, but I am just starting C++). At the current moment I have this class file #include "Cube.h" #include <freeglut.h> #include <stdio.h> Cube::Cube(int cx, int cy, int cz , int cubeWidth) { int p[][3] …

Member Avatar for David W
0
467
Member Avatar for JohnMcPherson

I am having a problem with reading input data after checking a position marker in the data file. The code that does the reading follows: fip = fopen("fprmf.txt","r"); . . . strcpy(passw,"P7"); fscanf(fip, "%3s", ckod); /* card # 164 */ fprintf(ff16,"\n\n%12s%12s\n", "card# 164 :", "Password "); printf("passwd is %s\n", ckod); …

Member Avatar for Nutster
0
797
Member Avatar for furalise

Hi again everybody. I know there are some references to this kind of thing around the web but none of them are simple enough for me to understand. In my code below, I am trying to initialize a function pointer with a class member function but I'm not sure I …

Member Avatar for furalise
0
483
Member Avatar for kyle.mace.35

quick question how can I work around this char * dat = "08/11/2014"; char test[10] = dat; I need to be able to take a string and put it into an array of chars, how can i do this?

Member Avatar for deceptikon
0
221
Member Avatar for admiri92
Member Avatar for Moschops
0
249
Member Avatar for can-mohan

Hi, While executing below code i am getting error like "memory clobbered before allocated block" and due to this assignment is not happening. could you let me know what can be reason for the same. I do understand it is not good to use raw pointer but in current scenario …

Member Avatar for can-mohan
0
442
Member Avatar for ravi_14

![6b87dfe9bac7df6c309f7266d28a4ad0](/attachments/small/4/6b87dfe9bac7df6c309f7266d28a4ad0.JPG "align-left") i am reading "pointers in c by naveen toppo" .According to him program crashes when it encounter int y=*ptr; i dont understand why it should crash?i think its correct. *ptr gives int value. please refer attachement.

Member Avatar for Ancient Dragon
0
163
Member Avatar for ravi_14

i was reading a book and came across this line "C++ matches a pointer of any other type with type void * and prints a numeric representation of the address. If you want the address of the string, you have to type cast it to another type," please any one …

Member Avatar for Ancient Dragon
0
185
Member Avatar for kent.johnstone_1
Member Avatar for chubbyy.putto

here is question: Write a function that accepts an array of integers and its size as arguments. The function should create a new array that is one element larger than the argument array. The first element of the new array should be set to 0. Element 0 of the argument …

Member Avatar for Ancient Dragon
0
328
Member Avatar for CoolAtt

Hi All, I got this code from a forum & tried it on g++/Linux. In the code below i put NULL to a pointer variable but didnt get any errors. #include <iostream> using namespace std; class A { private: int _dmember; public: void func() { cout<<"Inside A!! "<<endl; cout<<_dmember; // …

Member Avatar for CoolAtt
0
311
Member Avatar for Seba Sama

Hello, I came across a strange pointer (in my opinion): `void *(*foo)(int *);` Why are so many stars there? It was explained like: "...read inside-out; notice that the innermost element of the expression is *foo, and that otherwise it looks like a normal function declaration. *foo should refer to a …

Member Avatar for Seba Sama
0
221
Member Avatar for simran_4

Hello all, I am stuck with a nullpointerException at line 41 and 60.Can someone please help me out.any kind of help will be appreciated. Thanks import javax.swing.*; import javax.swing.event.*; import java.awt.Color; import java.awt.*; class calenders extends JFrame { int i=0; int j=0; int k=0; JFrame jf; FlowLayout fl; JPanel jp[]; …

Member Avatar for simran_4
0
557
Member Avatar for Angelrawzz

Hi, I am trying to create a function which takes two chars and a char* string. Then run the function and replace each occurence of Char1 with char 2. E.g. String = Apples. Char 1 = A. Char 2 = B. Char 1 is present in string so replace all …

Member Avatar for deceptikon
0
602
Member Avatar for gobiking

Hello, I made a program that worked perfectly on one of my pcs. When I moved it to another computer I am getting an error now stating that I need to include a pointer on my fmin and fmax functions. I'ts somewhat lengthy but I want to know if maybe …

Member Avatar for gobiking
0
330
Member Avatar for bluekb

#include <stdio.h> #include <stdlib.h> #include <string.h> #include "queue.h" #include "stack.h" #define NAME_SIZE 20 #define RECORDS_SIZE 100 typedef struct { char studName[20]; int timeEnter; int timeUpdate; }STUDENT; typedef struct { char tutorName[NAME_SIZE]; int tutorTime; STUDENT *ptr; }TUTOR; QUEUE *queue1; STACK *stack1; void getData(STUDENT *studArr[], TUTOR tutorArr[1]); int main(void) { STUDENT *studArr[RECORDS_SIZE]; …

Member Avatar for bluekb
0
346
Member Avatar for otengkwaku
Member Avatar for otengkwaku
1
392
Member Avatar for ram619

This code is crashing, please tell me for what all I need to assign memory. Thanks #include<stdio.h> #include<conio.h> #include<stdlib.h> struct s1 { char *p1; }; struct s2 { struct s1 *p2; }; struct s3 { struct s2 *p3; }*p4=NULL; int main() { char a='a'; p4=malloc(sizeof(struct s3)); p4->p3->p2->p1=&a; printf("%c",*(p4->p3->p2->p1)); return 0; …

Member Avatar for ram619
0
126
Member Avatar for James19142

I used `memcpy` to copy the contents of one pointer to another pointer assigned to new memory. Later in the program I get runtime errors as if I were attempting to operate on a pointer pointing to nothing. While debugging, I saw that the original and the the copied pointer …

Member Avatar for James19142
0
2K
Member Avatar for AndrewEPage

Just a thought that woke me up this morning. A means of providing 'property' type constructs in C++ classes similar to python properties. # Header # #ifndef _HXX_CPROP #define _HXX_CPROP /** * Helper class to connect a 'property' in a * c++ class to getter/setter methods * */ template<class T, …

Member Avatar for mrnutty
0
3K
Member Avatar for DelilahDemented

I have an array of structs that contains an account number and a balance. I open a file which contains an account number and an amount that needs to be either added or subracted from the correct account. My problem is it is adding and subracting to the first account …

Member Avatar for np complete
0
165
Member Avatar for DelilahDemented

I think I am getting bad data because I have my pointer doing the wrong thing, I just don't know exactly how to fix it. Any help is greatly appreciated! output: Number: 4669840 Name: Value: 3.76441e-039 Number: 4218312 Name: Value: 6.52879e-039 Number: 2686408 Name: Value: 6.52879e-039 Number: 128 Name: Value: …

Member Avatar for DelilahDemented
0
211
Member Avatar for DelilahDemented

I'm trying to read information from a text file and populate an array of structs using a pointer. I keep getting an error and I'm not sure how to fix it. Any help, comments, or tips are greatly appreciated! Thanks in advance for your time and help! error: request for …

Member Avatar for Ancient Dragon
0
371
Member Avatar for somjit{}

i want to take the 1st argument from commandline, ie argv[1] and assign it to a `char target[80]` i know im making some very stupid beginer mistakes... but just cant understand what :( this is my code: #include <stdio.h> #include <string.h> void converge(char *targ, char *src); int main(char *argc[],char *argv[]) …

Member Avatar for somjit{}
0
4K
Member Avatar for Alexkid

Hi there I have a question about pointers, i have a functions that takes a path to a txt file, extracts whats in it into an array and returns the array. As i understand it you can't actually pass the array, you have to return the pointer to the array …

Member Avatar for Alexkid
0
253
Member Avatar for piero.costa

Hi guys, I'm facing a new problem. Now I'm learning how to send signals to process in order to make them communicate. I was trying to create a process and when this process is created, send a signal to his father... But I had no success. I get a bunch …

Member Avatar for rubberman
0
754
Member Avatar for piero.costa

Hi guys, I'm learning C and I still don't have some concepts very clear in my mind. I have to create a program that get the values from ARGV[] and puts into a vector: the program would work like that: ./program file1 file2 file3 My idea was to do something …

Member Avatar for Ancient Dragon
0
4K
Member Avatar for trishtren

Hey, iv been working on a fairly simple part of my program but it throws a null pointer exception. The error i recieve is : Exception in thread "main" java.lang.NullPointerException at FillStyle.<init>(FillStyle.java:12) at compiler.main(Builder.java:43 The code causing the error is : public FillStyle(int type) { if (type >= 0) { …

Member Avatar for trishtren
0
276

The End.