Could you please explain a little bit in more depth how I would use it? Perhaps an example?
Type: Posts; User: tictac232434
Could you please explain a little bit in more depth how I would use it? Perhaps an example?
Hello, I am trying to do a string copy in C++. I have gotten the first one in my code to work, but the next one that accesses my classes does not work. The string compares however do.
void...
I've narrowed the error down to the get_firstName.
It has to do with the pb[i].cfirstName
nvm solved....
I am really close to finishing this project. I just have to fix this final problem. Any help is greatly appreciated. Try compiling this code and adding 2 friends then do option 4 to display all...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_NAME_LENGTH 40
typedef struct {
char cfirstName[MAX_NAME_LENGTH];
char clastName[MAX_NAME_LENGTH];
char...
I am trying to do a swap. I have to use the -> operator. The purpose of this is to delete a contact in a phonebook. The previously mentioned operator has to be used because it is the easiest way to...
void addfriend(book * pb, int * ptrX, char * buff){
realloc(pb, *ptrX * sizeof(book));
//if(newBuff==NULL){
// printf("Error allocating memory\n");
// ...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct phonebook{
char * firstName;
char * lastName;
Good point Tim, I did for my initial structure, but not for this.
buff = (char *)malloc(sizeof(char));
Within my main doesn't seem to work though... any ideas?
void addfriend(book * pb, int * ptrX, char * buff);
main(){
if(option == 1){addfriend(pb, ptrX, * buff);}
}
I appreciate the help iMalc.
Its moving the first letters of each name. Is there a way to move the full names?
I am getting close just need a bit of help...
for(i = 0;i < 10;i++){ for(j = 0; j < 10;j++){
if(strcmp(str[j], str[j+1])){
temp = str[j][i];
...
This this is what I have so far. I am trying to sort these name alphabetically. So the output should be "Barney, Dino, Fred, Pebbles, Dino"
Also I have to use strcmp.
#include <stdio.h>...