zoukankan      html  css  js  c++  java
  • C语言void*和*p的使用

    #include <stdio.h>
    #include <stdlib.h>
    #include <limits.h>
    #include <time.h>
    #include <pthread.h>
    #include <semaphore.h>
    #include <unistd.h>
    #include <signal.h>
    #include <string.h>
    #include <stdlib.h>
    
    #define USB_CLASS_VIDEO 0x0e
    #define UVC_SC_VIDEO_INTERFACE_COLLECTION  0x03
    #define UVC_INTF_VIDEO_CONTROL   0
    #define USB_DT_INTERFACE_ASSOCIATION 0x0b
    
    typedef __signed__ char __s8;
    typedef unsigned char __u8;
    
    typedef __signed__ short __s16;
    typedef unsigned short __u16;
    
    typedef __signed__ int __s32;
    typedef unsigned int __u32;
    
    
    /* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
    struct usb_interface_assoc_descriptor {
    	__u8  bLength;
    	__u8  bDescriptorType;
    
    	__u8  bFirstInterface;
    	__u8  bInterfaceCount;
    	__u8  bFunctionClass;
    	__u8  bFunctionSubClass;
    	__u8  bFunctionProtocol;
    	__u8  iFunction;
    } __attribute__ ((packed));
    
    
    
    static struct usb_interface_assoc_descriptor uvc_iad = {
    	.bLength = sizeof(uvc_iad),
    	.bDescriptorType = USB_DT_INTERFACE_ASSOCIATION,
    	.bFirstInterface = 0,
    	.bInterfaceCount = 2,
    	.bFunctionClass = USB_CLASS_VIDEO,
    	.bFunctionSubClass = UVC_SC_VIDEO_INTERFACE_COLLECTION,
    	.bFunctionProtocol = 0x00,
    	.iFunction = 0,
    };
    
    //0-8 ?
    int main()
    {
    
        struct usb_interface_assoc_descriptor* puvc_iad = NULL;
        puvc_iad = &uvc_iad;
    
        printf("  sizeof %d  
    ",sizeof(*puvc_iad));
        printf("p is sizeof %d
    ",sizeof(void*));
    
    
    
    
        for(;;);
        return 0;
    }
    

      

    一勤天下无难事。
  • 相关阅读:
    遍历数组
    push/pop和unshift/shift
    完全卸载oracle11g
    截图神器-snipaste
    截图神器-snipaste
    VS2015 +.NETMVC5 +EF实践
    VS2015 +.NETMVC5 +EF实践
    github 客户端总是登录失败,提示密码错误
    github 客户端总是登录失败,提示密码错误
    【.NET MVC分页】.NET MVC 使用pagelist 分页
  • 原文地址:https://www.cnblogs.com/nowroot/p/13850168.html
Copyright © 2011-2022 走看看