Gustavo Ramirez
/
eje13
este programa es para botones
main.cpp@1:04f4905dd2ae, 2015-03-13 (annotated)
- Committer:
- tony63
- Date:
- Fri Mar 13 15:33:03 2015 +0000
- Revision:
- 1:04f4905dd2ae
- Parent:
- 0:68deb959efd5
este es un ejemplo del viernes 13
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:68deb959efd5 | 1 | #include "mbed.h" |
tony63 | 1:04f4905dd2ae | 2 | |
tony63 | 1:04f4905dd2ae | 3 | // Function which takes a pointer to a char* buffer. |
tony63 | 1:04f4905dd2ae | 4 | void BufferRead(char* pBuffer) |
tony63 | 1:04f4905dd2ae | 5 | { |
tony63 | 1:04f4905dd2ae | 6 | * pBuffer = 'h'; |
tony63 | 0:68deb959efd5 | 7 | } |
tony63 | 1:04f4905dd2ae | 8 | |
tony63 | 1:04f4905dd2ae | 9 | int main() |
tony63 | 1:04f4905dd2ae | 10 | { |
tony63 | 1:04f4905dd2ae | 11 | void* pvBuffer = malloc(42); |
tony63 | 1:04f4905dd2ae | 12 | |
tony63 | 1:04f4905dd2ae | 13 | // Calling BufferRead with a void* pointer instead of a char* pointer. |
tony63 | 1:04f4905dd2ae | 14 | BufferRead((char*)pvBuffer); |
tony63 | 1:04f4905dd2ae | 15 | //BufferRead(pvBuffer); // *** This is the line which generates the error. *** |
tony63 | 1:04f4905dd2ae | 16 | |
tony63 | 1:04f4905dd2ae | 17 | return 0; |
tony63 | 1:04f4905dd2ae | 18 | } |