0

I'm trying to scroll some text and pull out 20 characters from it using this function:

//scrollin da tweet like wall street mfs
int TweetScrolling(char txt, int ScrollNum)
{

    char Scrolled[20]; //where we wanna store da scrolled tweet

    if (strlen(txt) <= 20)
    {
        //the sting fits on one line, no conversion needs to be done
        Scrolled[0] = txt;
        Scrolled[20] = '\0'; // place the null terminator
        return Scrolled;
    }
    else if (strlen(txt) >= 21)
    {
        //string is bigger than 1 line (20) Time for some scrolling!

        strncpy(Scrolled, txt + ScrollNum, 19);
        Scrolled[20] = '\0'; // place the null terminator

        return Scrolled;
    }
    else
    {
        //somthing has gone terribly wrong
        strcpy(Scrolled, "error!");
        Scrolled[20] = '\0'; // place the null terminator
        return Scrolled;
    }
}

and later on inside of another function, I call it,

void DSPTWEET(char VERSION[20],char AUTHOR[20],char TWEET[280],char TANDD[20],char NUMLIKES[20],char NUMCOMMENTS[20],char NUMRT[20],int SCROLL) {

    /* This is line 103 */ char SCROLLEDTWEET[20] = TweetScrolling(TWEET,SCROLL);
...
...

and move on to other stuff.

The issue I'm having is i get these 2 errors:

main.c:103: error 78: incompatible types
from type 'signed-char generic* auto'
  to type 'signed-char auto'
main.c:103: error 69: struct/union/array '': initialization needs curly braces

I haven't been able to find a way to fix the first error (web surfing for 2 hours didn't do the trick this time) and I'm unsure where the second error even comes from.

any help or tips are deeply appreciated!

anastaciu
  • 23,467
  • 7
  • 28
  • 53
Jaden spef
  • 13
  • 2

0 Answers0