宏定义这个怎么改?
#define geta(x,n) \
int c;\
while(n)\
{ \
c = x%10;\
x=x/10;\
n--;}\
return c;
int main()
{
int d;
d = geta(3215,2);
2 #include <stdio.h>
3 #include <string.h>
4
5
6 #define geta(x,n,c) \
7 { \
8 while(n) \
9 { \
10 c = x%10; \
11 x = x/10; \
12 n--; \
13 } \
14 }\
15
16
17 int main()
18
19 {
20 int a = 3215, b = 2;
21 int c = -1;
22 geta( a, b, c);
23
24 printf("### d = %d \n", c);
25
26 return 0;
27 }
~
1 #include <stdio.h>
2 int d,n;
3
4 #define geta(x,n) \
5 int c; \
6 while(n) \
7 { \
8 c = x%10; \
9 x=x/10; \
10 n--;} \
11 d=c;
12
13 int main()
14 {
15 d = 3215;
16 n = 2;
17 geta(d,n);
18 }
19
~
325 #define kstrto_from_user(f, g, type) \
326 int f(const char __user *s, size_t count, unsigned int base, type *res) \
327 { \
328 /* sign, base 2 representation, newline, terminator */ \
329 char buf[1 + sizeof(type) * 8 + 1 + 1]; \
330 \
331 count = min(count, sizeof(buf) - 1); \
332 if (copy_from_user(buf, s, count)) \
333 return -EFAULT; \
334 buf[count] = '\0'; \
335 return g(buf, base, res); \
336 } \
337 EXPORT_SYMBOL(f)
338
339 kstrto_from_user(kstrtoull_from_user, kstrtoull, unsigned long long);