Search:

Type: Posts; User: tmac619619

Page 1 of 7 1 2 3 4

Search: Search took 0.01 seconds.

  1. Is C playing tricks with me? Random Seg faults

    Header #1 city.h



    typedefstructCity{

    double* lat;
    double* lon;
    double* pop;
  2. Replies
    3
    Views
    566

    Fgets problem or text file issue?

    I'm trying to read line by line from a text file




    FILE *fp;
    fp = fopen("airport.txt","r");
    if (fp == NULL)
    {
    exit(1);
  3. Thanks! ^^

    Thanks! ^^
  4. Struct declaration failed. (very few lines of code)

    //This is the header file

    #ifndef VECTOR_H
    #define VECTOR_H
    #include <stdio.h>

    typedef struct Vector Vector;


    #endif
  5. Code works.... but I don't know why (recursion)

    #include <stdio.h>
    #include <string.h>
    void get_first_x(char *line,char *line2,char *line3);
    void display(char *line);

    int main(int argc, const char * argv[]) {

    char line[256];
    ...
  6. Replies
    1
    Views
    715

    Maze Recursion Algorithm flawed?

    Algorithm:




    FIND-PATH(x, y)


    if (x,y outside maze) return false
    if (x,y is goal) return true
  7. @laserlight thanks for the formatting tip. ...

    @laserlight thanks for the formatting tip.




    int find_path(char maze[][8],int x, int y) {

    if(x>6)
    {
    return 1;
  8. Hi laserlight, Without the exit statement, my...

    Hi laserlight,

    Without the exit statement, my function becomes an infinite recursion and seg faults.
  9. Whats wrong with simple recursion printing program?

    int find_path(char maze[][8],int x, int y);

    int main(int argc, const char * argv[]) {

    int x = 0;
    int y = 0;
    char maze[8][8];

    FILE *fp;
    fp = fopen...
  10. Thanks I understand!

    Thanks I understand!
  11. #include #include void...

    #include <stdio.h>
    #include <stdlib.h>

    void foo(int *p)
    {
    p = malloc(sizeof(*p));
    printf("foo: %p\n", (void*)p);
    }

    void bar(int **p)
  12. Can someone further explain an explantation? Triple pointers vs double pointers

    void init(char***subjects_array,char***courses_array)
    {


    int i;

    *subjects_array =(char**) malloc (100*sizeof(char*));
    *courses_array =(char**) malloc(100*sizeof(char*));
  13. Replies
    2
    Views
    789

    Syntax for 1D array of char pointers

    char* middle_initial;
    middle_initial =(char*) malloc(size*sizeof(char));

    for(int i =0; i<5;i++){

    middle_initial[i]=*(char*) malloc(middle_max*sizeof(char));// Please focus on this...
  14. Got it! Thanks alot

    Got it!

    Thanks alot
  15. Hi! Yes your code is perfect! I'm comparing...

    Hi!

    Yes your code is perfect! I'm comparing mines with yours right now... but what seems off?


    my output



    input: birds and bees
  16. Printf statement within a decrementing for loop does not print correctly

    int main(int argc, const char * argv[]) {

    char str[79];
    char reverse[79][79];
    char *ptr;

    int i = 0;
    printf("Input: ");
  17. Thanks Solved!

    Thanks Solved!
  18. Completely stumped on += operator. (5 lines of code)

    void declare_winner (int temp2[],int counter,int i) {

    for(i=0;i<=3;i++){

    counter += temp2[i];

    } // prints out a WRONG value (358484)

    counter =...
  19. Im using Codeblocks. Weird, i placed all of my...

    Im using Codeblocks. Weird, i placed all of my files into a console application project folder but somehow the linking gets fcked
  20. Oh ok it works when i use a makefile. Any...

    Oh ok it works when i use a makefile.

    Any ideas as to why it prints out junk values?

    input: 1,2

    output: -2113342424
  21. Simple function call in main not working ( Classes)

    So I have 2 files linked: Fraction.h and main.cpp

    Fraction.h contains function definitions and declarations

    main.cpp is where int main is:
  22. What is the return value for a type Class? code example

    returnType operatorOperatorSymbol (parameterList); // syntax for operator overloading


    Class Fraction

    public:
    Fraction operator-(const Fraction& f1)
    {
    Fraction r;
    return r;
  23. C++ beginner here... Can't quite figure out how to implement this input.

    Here's the assignment


    Description
    Create a simple fraction calculator that can add and subtract any number of fractions and writes
    the answer as a reduced fraction.
    Your program will read...
  24. Breaking out of a While loop with Nested If statements

    while(x==1)
    {
    for (i=0;i<j;i++)
    {
    if (word1[i] == word2[i])
    {
    prefix[i]= word2[i];
    counter++;
    }
    else
  25. Simple Prefix Programming giving weird results

    #include <stdio.h>
    #include <string.h>


    int smaller_value(int length_word1,int length_word2);
    int main (void)
    {


    char word1[256];
Results 1 to 25 of 166
Page 1 of 7 1 2 3 4