Recent content by pheeesics

  1. P

    Conversion from 'Shape*' to non-scalar type 'Shape' requested

    I don't receive this error. Here is the .c file I compile with using gcc. How are you declaring your structure in the main() function? #include <stdio.h> typedef struct { int tShape; int centerX; int centerY; int sizeX; int sizeY; int color; int filled; } Shape...
  2. P

    Passing Strings as Arguments to Functions in C

    It is my understanding that the string is allocated in a function 'frame' on the stack whenever you call myfunc("text"). Somebody PM me if I am mistaken. Stick with char * str unless you want the string to be unedited. The const (basically) make the compiler alert you when you try to change the...
  3. P

    How can I efficiently capitalize items in a list without modifying the original?

    My Python knowledge is very limited, but I hope I can help. If you are unable to return a list defined within a function, then you are conflicting with the scope of variables inside of functions. What is the lifetime of lst2 in the function? That is, do local variables to the function 'die' when...
  4. P

    Learn C Programming: Tips for Engineering Student

    Yes it does have practice problems and examples throughout the book. I highly recommend it.
  5. P

    A link to a collection of tutorials and videos on MATLAB.

    That link is no longer valid. I saved the PDF the other day however, if anyone is interested.
  6. P

    Can you Simplify These Boolean Expressions Using the Laws of Boolean Algebra?

    I believe you violated DeMorgan's Theorem in step one, like magwas said. I see in i) you complemented the overall output, starting with the + as the outermost operation. Yet you complement A AND NOT B individually, instead of as a whole. Remember that (A . NOTB) is an input of itself. Once you...
  7. P

    What definition of #define cont 32767

    In addition to CompuChip's response, the number may come from the range of integers in different situations. I can't confirm since the entire code is not pasted and I cannot see its use (Though as previously stated, with the define it is strictly a replacement), but if you are interested in...
  8. P

    How can I efficiently pass variables from an m-file to a function in MATLAB?

    Perhaps I am misunderstanding the question, but you call the function in your main ".m" file (script). Assuming your function name is "shift(input1, input2)", then it should be stored in "shift.m", (as it is a function, and they are typically stored in separate files). You call it appropriately...