language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "test_utils.h"
void test_blockBounds_single_processor()
{
bounds const interval = {0, 100};
bounds const subInterval = blockBounds(&interval, 1, 0);
// When there is only one processor involved, the sub-interval should
// equal the interval.
TEST_ASSERT_EQUAL_UINT(
interval.lower... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *file_input;
file_input = fopen("../my-text.txt", "w");
fprintf(file_input, "First try: Kovács Gergő\n");
fputs("Second try: Kovács Gergő\n", file_input);
char name[25] = "Third try: Kovács Gregő\n";
for (int i = 0; i < sizeof(name);... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#define INICIO 0
#define MAXTAM 1000
typedef struct {
int chave;
/* outros componentes */
} TItem;
typedef struct {
TItem item[MAXTAM];
int primeiro, ultimo;
} TLista;
/* procedimentos e funcoes da TAD */
void TLista_Criar(TLista *pLista);
int TLista_EhVazia(TLista *pLista)... |
C | #include <stdio.h>
int main()
{
float cel,farenheit;
int lower, upper, step;
lower=0;
upper=300;
step=20;
cel=lower;
printf("Temperatures °C --> °F\n");
while (cel<= upper){
farenheit=(cel*(9.0/5.0))+32;
printf("%3.0f%6.1f\n", cel, farenheit);
... |
C | /********************************************************/
/* Nom : DANIEL Maxime */
/* Groupe : 2125 */
/* Contact: maxux.unix@gmail.com */
/* File : Vérifier si matrice diagonal */
/********************************************************/
/* VC++ 2008 scanf Warning Fix */
#define _CRT_S... |
C | #include "fonction.h"
int main()
{
FILE *livre1,*livre1_compr,*livre1_binaire,*livre1_compr_dico; //creation de pointeurs sur les fichiers texte livre
livre1_compr_dico = fopen("Biblio/Livre1_compr_dico", "w+");
livre1 = fopen("Biblio/Livre1", "r"); ... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
// 使用指针访问数组
int p[] = {1,2,3};
int *c;
c = p;
for(int i = 0;i<3;i++){
printf("%d\n",*(c+i));
}
/* code */
return 0;
}
|
C | /*
* 015UART_tx.c
*
* Created on: 01-Mar-2021
* Author: sayan
*/
#include <stdio.h>
#include <string.h>
#include "stm32f407xx.h"
/*
* UART communication pins
* PA2----> TX
* PA3----> RX
*/
char msg[1024] = "USART Tx testing...\n\r";
USART_Handle_t USART2_handle;
void USART2_Init(void)
{
USART2_hand... |
C | #include <stdio.h>
int main()
{
printf("|%d| \n", 123); //숫자의 길이만큼 출력 폭이 자동 지정됨
printf("|%5d| \n", 123); // 총 5자리로 오른쪽부터 채워짐
printf("|%-5d \n", 123); // 총 5자리로 왼쪽부터 채워짐
printf("|%05d| \n", 123); // 총 5자리로 오른쪽부터 채워지고, 공백은 0으로 채워짐
printf("|%6.1f| \n", 123.45); // 총 6자리(소수점 포함)로 소수점 이하 1... |
C | #ifndef SEQLISTHEADER //防止重复包含
#define SEQLISTHEADER
#include<stdio.h>
#include<stdlib.h>
#define SIZE 5
//顺序表结构
typedef struct SeqList
{
int* head;
int len;//记录顺序表当前长度
int size;//记录顺序表分配的存储容量
}SeqList;
/*
*功能:初始化顺序表
*参数:SeqList* s 顺序表地址
*返回值:无
*/
void init(SeqList* s);
/*
*功能:显示所有元素
*参数:SeqList* s 顺序表... |
C | #include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
typedef union test_
{
uint16_t idata;
char ch[2];
}test_t;
bool
is_little_endian()
{
uint32_t num = 0x12345678;
uint8_t *ptr = #
if(*ptr == 0x78 && *(ptr+1) == 0x56)
return true;
else
return false;
}
int
main()
{
test_t t;... |
C | /*
File: protoProtoEditor.h
Contains: protoProtoEditor native functions for the Newton Toolkit editor view.
Written by: Newton Research Group, 2008.
*/
extern "C" {
Ref Selection(RefArg inRcvr);
Ref SelectionOffset(RefArg inRcvr);
Ref SelectionLength(RefArg inRcvr);
Ref SetSelection(RefArg inRcvr, RefArg inStar... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// л ü
struct Student
{
char name[50];
int age;
int grade;
};
// л Student ü ϰ ȯϴ Լ
struct Student* get_students(int num_students)
{
struct Student* students = (struct Student*)malloc(num_students * sizeo... |
C | /*
File : RMS.c
Description : Main working plate from
Author : Dipin Khadka
Created : 17 april 2011
-----------------------------------------------------------------------
Date Version Author Description
17 april 2011 1.01 Dipin
29 may 2011 1.02 Dipin Added logic to dis... |
C | struct Person {
char *name;
int age;
char *address;
} ;
int main() {
struct Person p1;
p1.name = "Kim";
^@$%^&*;
p1.age = 25;
p1.address = "Seoul";
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* display.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "data.h"
#include <string.h>
#include <math.h>
void str_to_stu (struct student *stu , char* str)
{
char *tok ;
tok = strtok (str , ",") ;
strcpy (stu->name , tok) ;
tok = strtok (NULL , ",") ;
stu->cgpa = (double) atof(tok) ;
}
void input_all_records (struct stude... |
C |
#include <stdio.h>
#include <math.h>
int main()
{
int add = math(1,4,'+');
int sub = math(5,2,'-');
int mult = math(2,3,'*');
int divide = math(9,3,'/');
int mod = math(9,2,'%');
printf("%d \n", add);
printf("%d \n", sub);
printf("%d \n", mult);
printf("%d \n", divide);
pr... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sched.h>
#include <mpi.h>
#include <math.h>
#define G 10e-06
#define epsilon 0.5
#define gamma 0.05
//This represents a particle position, velocity, force (in a 3d vector) and energy
typ... |
C | /**
* This file is part of the FabricDB library
*
* Author: Mark Wardle <mark@themarkside.com>
* Created: March 23, 2015
* Updated: March 25, 2015
*/
#include <stdio.h>
#include <string.h>
#include <assert.h>
#ifndef _FABRIC_TEST_ALL__
#include "Fabric.c"
#endif
void test_create_db() {
FILE *db_file;
G... |
C | /* -------------------------------------------------------------------- */
/* Fichier d'entête pile */
/* */
/* Contient les prototypes des fonctions de traitement d'une pile */
/* et la structure qui définit une pile et le type d'élément de... |
C | #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/time.h>
#include <string.h>
#include "shm.h"
Message* p_msg;
int shmemory;
int semaphore;
void intHandler(int sig) {
//turn off shared mem... |
C | #include <stdio.h>
#include <stdlib.h>
void dM(void);
int main(void)
{
dM();
system("pause");
return 0;
}
void dM(void)
{
double dM, dCm;
printf("cm Է : ");
scanf("%lf", &dCm);
dM = dCm / 100.0;
printf("meter value : %.2lf\n", dM);
return;
} |
C | #include "write.h"
#include "object.h"
#include <stdio.h>
static inline void lusp_write_string(struct lusp_object_t object)
{
putc('"', stdout);
for (const char* value = object.string; *value; ++value)
{
if (*value == '\\' || *value == '"') putc('\\', stdout);
putc(*value, stdout);
}
putc(... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char str[501];
int x=0, ms=0;
while (gets(str)!=NULL)
{
x=strlen(str);
ms+=x/30;
if(x%30!=0)
ms++;
}
if (ms <= 15)
printf("1.0");
else
printf("%.1lf", 1.0+(ms-15)*0.1);
}
/*****... |
C | // Author : Aryan Sharma 133
#include <stdio.h>
# define MAX 5
int queue[MAX] , val ,rear = -1 , front = -1 , wasted = 0;
void insert(); // enqueue
void delete(); // dequeue
void display();
void memory(); // memory wated
int main()
{
int ch;
do{
printf("\n\nEnter :\n"); ... |
C | #include "aes.h"
#define MAX_MSG_LENGTH 65536
#define BLOCK_LEN 16
int main()
{
u8 CipherBase64[MAX_MSG_LENGTH];
u32 CipherBase64Length = FileReadIgnoreSpace(CipherBase64, "7.txt", MAX_MSG_LENGTH);
Stopif(CipherBase64Length == MAX_MSG_LENGTH, "File too long");
u8 Cipher[MAX_MSG_LENGTH];
u32 CipherLengt... |
C | #include <stdio.h>
#include <string.h>
int factorial(int number)
{
if (number <= 1)
{
return 1;
}
return number * factorial(number - 1);
}
typedef struct
{
char firstName[32];
char lastName[32];
int age;
int weight;
} Person;
int main()
{
Person me = {"Ayoub", "Taouarda"... |
C | //
// convert_ned13.c
// TVStudy
//
// Copyright (c) 2016 Hammett & Edison, Inc. All rights reserved.
// Convert NED 1/3-second data files in GRIDFLOAT format into tvstudy format. This reads a float file into memory,
// processes and writes out a tvstudy output file to the NED13 output directory (defined in head... |
C | #include "holberton.h"
#include <stdio.h>
/**
* _strcpy - check the code for Holberton School students.
* @dest: pointer to destination
* @src: pointer to source
* Return: the value stored within dest
*/
char *_strcpy(char *dest, char *src)
{
int a;
for (a = 0; src[a] != '\0'; a++)
{
dest[a] = src[a];
}
... |
C | #include "road.h"
#include "myString.h"
#include<string.h>
///////////////////////roadList/////////////////////////////
//usuwa listę dróg
void roadListDelete(RoadList *l) {
if (l == NULL)return;
RoadList *p = l->next;
RoadList *temp;
while (p != NULL) {
temp = p->next;
free(p);
p = temp;
}
free(l);
re... |
C | #include <stdio.h>
#include <event.h>
#include <evhttp.h>
#include <unistd.h>
/**
* 处理HTTP请求
* @param request
* @param arg
*/
void handle_request(struct evhttp_request *, void *);
int main() {
u_int16_t port = 10000;
char *host = "0.0.0.0";
struct evhttp *server = NULL;
event_init();
server =... |
C | #include "main.h"
#define TIME_SLEEP 2
#define DURATION 20
void print_usage(){
printf("Usage: sys_monitor -C max_cpu -O ok_cpu -M max_memory \n");
}
int main(int argc, char *argv[])
{
int option = 0;
int MAX_CPU = -1;
int OK_CPU = -1;
int MAX_MEM = -1;
head_p proc_head;
head_b buf_head;
while ((op... |
C | //
// main.c
// t5c1e1-1
//
// Created by Vicente Cubells Nonell on 10/06/14.
// Copyright (c) 2014 Vicente Cubells Nonell. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int actualizaTortuga(int tortuga);
int actualizaLiebre(int liebre);
void imprimirTabla(in... |
C | #include<stdio.h>
int factr(int n);
int main(void) {
int n;
printf("Enter the number to find its factorial");
scanf("%d", &n);
printf("%d\n", factr(n));
return 0;
}
int factr(int n) {
if(n >= 1) {
return n * factr(n - 1);
}
else {
return 1;
}
}
|
C | /*
** env.c for env in /home/leroy_0/tek1/PSU_2015_42sh/built-in/env
**
** Made by leroy_0
** Login <leroy_0@epitech.net>
**
** Started on Fri May 6 12:24:49 2016 leroy_0
** Last update Wed May 18 15:48:40 2016 longle_h
*/
#include <stdio.h>
#include "my.h"
char **my_env(char *str, char **env)
{
int cpt;
(... |
C | #include "touchScreenSM.h"
#include <stdio.h>
#include <string.h>
#include <xc.h>
#include <stdlib.h>
//all state for this stateMachine
typedef enum state3{WAITING,CALCULATEPOSITION} state3;
extern const FONT_INFO arialNarrow_12ptFontInfo;
state3 touchScreenState;
extern XF theXF;
//-------------------------------... |
C | /*unittest2.c
This file will test the getCost function.
The tests below will check the following aspects of the getCost function:
1) Whether getCost returns the correct values of given cards
*/
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <a... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 10
typedef struct aluno {
int matricula;
char nome[50];
int idade;
char telefone[30];
float renda;
int nota;
} Aluno;
Aluno List[N];
int Cont = 0; //Contador Global
int FlagSalvar = 0; //0 Salvo - 1 Não Salvo.
void addAlun... |
C | #include <stdio.h>
int main (void)
{
short x = -10;
unsigned short bits = *((unsigned short*)&x);
printf("bits = %#x\n", bits);
return 0;
}
|
C | /*
Vamos a modificar ahora el ejercicio 6.3 para que el programa compruebe que el
número introducido está comprendido entre 1 y 10. En caso contrario, el programa
informará de que el número introducido no es correcto y volverá a solicitar el
número tantas veces como sea necesario, hasta que el número sea correcto.
U... |
C | /********************************************************************
*@file led.c
*@author Woody QQ2490006131
*@version V1.0
*@date 2016-10-14
*@brief LED ʼԼLED_Show
*******************************************************************/
#include "led.h"
#include "delay.h"
/*******... |
C | // Exercice Final chapitre 5
#include <stdio.h>
#define VALEUR 16
#define TARGET 17
int main ()
{
printf ("Nous allons additioner: %d \n", VALEUR);
printf ("Avec: %d \n", TARGET);
printf ("Total: %d", VALEUR+TARGET);
return (0);
}
|
C | #include <stdio.h>
#include "minunit.h"
/* Unit testing added by Tim Dorny
In-Class Example Aug 31 2016*/
/*
Implement sum() to summary an array of integers
- using `goto` and labels
- without using `for`, `while`, or `do`
- with only one-armed `if`s
- with only `goto` in the "then" part of `if`
... |
C | #include<time.h>
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
#include<unistd.h>
#include<linux/kernel.h>
#include<sys/syscall.h>
int main()
{
int pid,uid;
uint32_t i;
uint32_t buffer_size = 25;
int32_t *usort_array = NULL;
int32_t *sort_array = NULL;
time_t T =time(NULL);
struct tm tm = *localtime(... |
C |
#include <insense/IteratedList.h> // for linked list
#include <insense/DAL_error.h> // for DAL_error macro
static char *file_name = "IteratedList";
// Removes an element from the list l, decrements ref count on element
void removeElement(List_PNTR l, void *element) {
// case: error, l is null, i.e. no l... |
C | /**
* @file MqttClientTimerMng.c
* @author dr-paradox
*
*/
/*------------------------------------ INCLUDES ------------------------------------*/
#include "MqttClientTimerMng.h"
/*------------------------------------ DEFINES -------------------------------------*/
#define THIS(index) (instance_params[(index)])
... |
C | /******************************
* led的char驱动例子3
* 采用gpio库控制gpio引脚输出的电平;
* 支持char驱动,通过ioctl命令来控制LED;
* 通过/proc/ledinfo文件获得灯的当前信息
* Author: zht
* Date: 2018-01-08
******************************/
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/miscdevice.h>
#include <linux... |
C | int main()
{
int n; //?????
cin>>n;
if(n<2)
return 0;
double x[n],y[n],m; //?????? ?????????
for(int i=0;i<n;i++)
cin>>x[i]>>y[i];
m=sqrt((x[1]-x[2])*(x[1]-x[2])+(y[1]-y[2])*(y[1]-y[2])) ;
for(int i=0;i<n;i++)
for (int j=0;j<n;j++)
{
... |
C | #include <msp430.h>
#include "Tanner's MSP Lib/setup/setup.h"
#include "Tanner's MSP Lib/led/led.h"
#include "Tanner's MSP Lib/timer/timer.h"
/**
* main.c
*/
unsigned int period1 = 5000; //period of led1
unsigned int period2 = 22500; //period of led2
unsigned int period1_increment = 5... |
C | /*
Copyright (C) 2014 insane coder (http://insanecoding.blogspot.com/, http://chacha20.insanecoding.org/)
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE S... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.h :+: :+: :+: ... |
C | #// Requests a number from the user and determines whether it is a
// valid credit card number.
#include <cs50.h>
#include <stdio.h>
int get_checksum(long number);
int get_number_of_digits(long number);
int get_digit_from_number(long number, int index);
int main(void)
{
// int checksum = get_checksum(get_long("N... |
C | #include <string.h>
int strcmp(const char *X, const char *Y)
{
while(*X)
{
// if characters differ or end of second string is reached
if (*X != *Y)
break;
// move to next pair of characters
X++;
Y++;
}
// return the ASCII difference after converting char* to unsigned char*
return *(const unsigned c... |
C | // SLAE Exam Assignment #3: Egg hunter
// Author: Rikih Gunawan
#include<stdio.h>
#include<string.h>
#define EGG "\xce\xfa\xaf\xde"
unsigned char stage1[] = \
"\x31\xd2\x66\x81\xca\xff\x0f\x42\x8d\x5a\x04\x6a\x21\x58\xcd\x80\x3c\xf2\x74\xee\xb8"
EGG
"\x89\xd7\xaf\x75\xe9\xaf\x75\xe6\xff\xe7";
/*
// payload 1
// Lin... |
C | //
// Created by mac on 2017/10/30.
//
#include "FingerPianoMain.h"
FingerEntity *createFingerEntity(Node *list1, Node *list2,int *beatRenderIndexArr, int *list3,int statusASize) {
FingerEntity *fingerEntity;
fingerEntity = (FingerEntity *) malloc(sizeof(FingerEntity));
memset(fingerEntity, 0, sizeof(Fi... |
C | //**************************************************************************************************
//NAME: Shuyi Zhao
//COSC 5352, Advanced Operationg System
//Project #1: Basic MPI Communication
//Date Assigned: Wednesday, October 3, 2012
//Due Date: Wednesday, October 17, 2012 by 9:30 a.m.
//Objective: PART 1
//*... |
C | #include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/timerfd.h>
#include <rtl-sdr.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#define BAUDOT_PREAMBLE_LENGTH 8
#include "baudot.h"
int do_exit = 0;
static void sighandler(int signum) {
(void)signum;
do_exit = 1;
}
#define RTL_CH... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* listcontainer_addelement.c :+: :+: :+: ... |
C | #include <stdio.h>
int main(void)
{
float basicSal, com, totalSal;
int pos, sales;
printf("Enter the Executive Position: ");
scanf("%d", &pos);
printf("Enter Sales, Rs: ");
scanf("%d", &sales);
if (pos == 1)
{
if (sales >= 4000)
{
com = 50000 * 0.19;
totalSal = 50000 + com;
printf("Commission i... |
C | #include <stdio.h>
#include "holberton.h"
int _islower(char c)
{
if (c>='A'&& c<='Z')
return (1);
else
return (0);
}
|
C | /**
* libdmtx - Data Matrix Encoding/Decoding Library
* Copyright 2011 Mike Laughton. All rights reserved.
*
* See LICENSE file in the main project directory for full
* terms of use and distribution.
*
* Contact: Mike Laughton <mike@dragonflylogic.com>
*
* \file dmtxencodescheme.c
* \brief Logic for encoding ... |
C | /*
* CLI control client app for netsniffd
*
* Copyright (c) 2017 Alexander Shaposhnikov <sanchaez@hotmail.com>
*
* SPDX-License-Identifier: MIT
* License-Filename: LICENSE
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys... |
C | /**
*
* @author novemberizing <novemberizing@gmail.com>
* @since 0.0.1
* @date 2018. 6. 22.
*/
#include <stdlib.h>
#include <stdio.h>
#include "util.h"
#include "tree.h"
struct node * red_black_tree_node_new(int value, struct node * parent, struct node * left, struct node * right,... |
C | /*
Funcion que fija las 'reglas' para ordenar el arreglo de lados espejados.
Ordena ascendentemente segun el primer vertice del par que forman un lado.
*/
int comparar_vertices_u(const void* a, const void* b) {
// Casteo argumentos a punteros a la estructura 'lado'.
lado32* lado_a = (lado32*) a;
... |
C | #include "VelocityCommander.H"
#include <nrt/ImageProc/IO/ImageSink/DisplayImageSink.H>
#include <nrt/ImageProc/Drawing/Text.H>
using namespace nrt;
using namespace velocitycommander;
// ######################################################################
VelocityCommanderModule::VelocityCommanderModule(std::strin... |
C |
#include "os.h"
#include "timer.h"
#include "uart.h"
#include "led.h"
#include "time.h"
stk_t main_stk[STK_SIZE];
stk_t second_stk[STK_SIZE];
stk_t third_stk[STK_SIZE];
void main_task(void *arg);
void second_task(void *arg);
void third_task(void *arg);
int time = 0;
int
main(void)
{
init_os();
/* Init sys tim... |
C | #include"headers.h"
void execute_jobs(char ** parsed_commands){
//for(int j=0;j<=process_count;++j)printf("%d %s %d\n",j,process_list[j],process_pid[j]);
printf("NUMBER PID NAME STATUS\n");
char executable[1024];
for(int i=0,number=0;i<=process_count;++i){
/*if(strcmp(process_status[i],"kil... |
C | /********************************
*TO DO LIST
* - Finish functions by adding their data to buffer instead of using writeData command
* - write high on digital output pin to alert master comm arduino that UI data is available
* - Create talk(). Add additional functionality:
* - attached to interrupt on slave select pin ... |
C | #include<stdio.h>
int factorial(int *n);
int main()
{
int a,b;
printf("Enter the number of which you want to calculate factorial:");
scanf("%d",&a);
b=factorial(&a);
printf("Factorial of %d is=%d",a,b);
}
int factorial(int *n)
{
int i,j=1;
for(i=2;i<=*n;i++)
{
j*=i;
}
return(j);
}
|
C | /***
*
* database.c - Database part
* Here you can find all functions that deal with the database
*
* $Id: database.c,v 1.1.1.1 2003/11/20 20:08:17 daniel Exp $
*
***/
#include "wmr918.h"
#include <dbi/dbi.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// Database data
static char table[256]... |
C | #include "9cc.h"
// プログラムの文字列
char *user_input;
char *kwd_list[] = {"return", "if", "else", "while", "for", NULL};
char *reserved_list[] = {"==", "!=", ">=", "<=",
"+", "-", "*", "/",
"(", ")", ">", "<", "=", ";", "{", "}",
NULL};
// 現在注目しているト... |
C | #ifndef __BITOPS_H__
#define __BITOPS_H__
#include <asm/types.h>
/* Hamming weight */
static u8 b1 = 0x55; /* 01010101 */
static u8 b2 = 0x33; /* 00110011 */
static u8 b4 = 0x0f; /* 00001111 */
static inline u8 countbit_8(u8 val)
{
val = (val & b1) + ((val >> 1) & b1);
val = (val & b2) + ((val >> 2) & b2);
... |
C | /*
Dummy Driver for LinkedList
*/
#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/semaphore.h>
#include <asm/uaccess.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/random.h>
#define DUMMY_MAJOR_NUMBER 250... |
C | /*
* Copyright (c) 2016 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or... |
C | #include <stdio.h>
#include "a1.h"
// sliceNew can be smaller than slice by the amount of the oversent pixel data
inline int filter(int N, int width, int height, int AVERAGE, int QUICKSORT,
int startIndex, int endIndex, RGB *slice, RGB *sliceNew,
int end) {
RGB *p = sliceN... |
C | #include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include "seed.h"
// Adapted from: https://stackoverflow.com/a/323302/3025921
// and: https://burtleburtle.net/bob/hash/doobs.html
unsigned long mix(unsigned long, unsigned long, unsigned long);
void seed_random() {
unsigned long seed = mix(clock... |
C | #include <string.h>
int main(void)
{
char a [300];
int i;
int j;
for (i=0; i<300; i++){
a[i] = -1 -i;
}
j = strlen(a);
printf("%d\n", j);
for (i=0; i<j; i++){
printf("%10x", a[i]);
if (0==(i+1)%5){
printf("\n");
}
}
return 0;
}
|
C | /* Using bitfield */
#include <stdio.h>
#include <math.h>
struct bitTest {
unsigned a : 4;
unsigned b : 2;
unsigned c : 1;
unsigned d : 32; /* really big one */
};
typedef struct bitTest Test;
main(){
Test tester;
tester.a = tester.b = tester.c = 0;
for (int i = 0; i < 16; i++){
tester.a++;
tester.b++... |
C | #include <sys/types.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void _adp_log(int filter, const char *format, ...);
#define adpl_err(...) _adp_log(LL_ERR, __VA_ARGS__)
#define adpl_warn(...) _adp_log(LL_WARN, __VA_ARGS__)
#define adpl_notice(...) _adp_log(LL_NOTICE, __VA_A... |
C | #include <stdio.h>
int main(){
int score[5];
int sum = 0;
for(int i = 0; i < 5; i++){
scanf("%d", &score[i]);
if(score[i] < 40)
score[i] = 40;
sum += score[i];
}
printf("%d\n", sum/5);
return 0;
}
|
C | #include <stdio.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
/* #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) */
int main()
{
int a[] = {1, 2, 3, 4, 5, 6};
printf("size of array is: %d\n", ARRAY_SIZE(a));
return 0;
}
|
C | int main()
{
int a = 6;
int result = 0;
for (int i = 1; i < a; i++)
{
if (a % i == 0)
{
result += i;
}
else
{
result += 0;
}
}
return 0;
}
|
C | #include <unistd.h>
#include <stdio.h>
#include <signal.h>
#define TIMEOUT 5
#define MAXTRIES 5
#define LINESIZE 100
#define BELL '\007'
#define TRUE 1
#define FALSE 0
/* жϳʱǷѾı־*/
static int time_out;
static char inputline[LINESIZE];
char* quickreply (char* prompt);
void main()
{
printf("%s\n... |
C | #include<stdio.h>
int main() {
int n;
scanf_s("%d", &n);
return 0;
}
/*
#include<stdio.h>
//main a bٲܷ?
void changeNum(int* p1, int* p2) {
int temp = *p1;// *p1==10
*p1 = *p2;
*p2 = temp;
}
int main() {
int a = 10, b = 20;
changeNum(&a, &b);
printf("%d %d\n", a, b);
return 0;... |
C | #include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<math.h>
int main()
{
int n;
scanf("%d",&n);
int c[n];
for(int i=0;i<n;i++)
{
scanf("%d",&c[i]);
}
int t=-1;
for(int i=0;i<n;i++,t++)
{
if(i<n-2 && c[i+2]==0)
i++;
}
printf("%d",t);
return 0;
} |
C | #include<stdio.h>
#include<string.h>
#include<pthread.h>
#include<stdlib.h>
#include<unistd.h>
#include<stdlib.h>
pthread_t tid[2];
int statl = 100, statk = 100, stats = 0;
void* playandcount(void *arg){
unsigned long i=0;
pthread_t id=pthread_self();
int iter;
if(pthread_equal(id,tid[0])){
whi... |
C | #include <stdio.h>
int main()
{
char ch = ' ';
printf("Enter character: ");
scanf("%c", &ch);
switch(ch)
{
case 'a':
printf("Entered a!\n");
break;
case 'b':
printf("Entered b!\n");
case 'c':
printf("Entered c!\n");
break;
}
}
|
C | #include <stdio.h>
/*Leia duas notas de um aluno e escreva na tela a palavra Aprovado se a mdia das duas notas for maior ou igual a
7,0. Caso a mdia seja inferior a 7,0, o programa deve ler a nota do exame final e calcular a mdia final. Se esta
mdia for maior ou igual a 6,0, o programa deve escrever Aprovado, caso cont... |
C | /*
* File: utils.c
* Purpose: various utility routines relating to control flow graph construction.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "XedDisassembler.h"
#include "utils.h"
#include "cfgState.h"
/**
* Function: fetchInsInfo
* Description: Fetches additional information about ... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Begin .. \n");//注意缓冲区的问题 \n才输出的
pid_t pid = fork();//创建子进程
printf("pid = %d \n",pid);
if(pid <0 )
{
perror("fork err");
exit(1);
}
if(pid == 0 )//代表是子进程
{
while(1)
{
pr... |
C | #pragma once
#include "cbc/common.h"
enum cbc_operator_type
{
CBC_OPERATOR_BRACE_OPEN,
CBC_OPERATOR_BRACE_CLOSE,
CBC_OPERATOR_COLON,
CBC_OPERATOR_PAREN_OPEN,
CBC_OPERATOR_PAREN_CLOSE,
CBC_OPERATOR_SEMICOLON,
};
bool cbc_determine_operator(char const* s, size_t len, enum cbc_operator_type* type_out);
/*... |
C | #include "headerA3.h"
void loadTweetsFromFile(tweet ** tweetList){
char filename[100];
int userid;
char name[51];
char tweetString[141];
char buf[1024];
printf("\nEnter a filename to load from: ");
scanf("%s", filename);
FILE *file;
file = fopen(filename, "r");
if(file ==... |
C |
void OXoa()
{
textColor(148);
//Canh tren
gotoxy(37, 2);
for(int i=0; i<50; i++)
printf("%c", 205);
//Canh duoi
gotoxy(37, 10);
for(int i=0; i<50; i++)
printf("%c", 205);
//Canh trai
gotoxy(37, 3);
for(int i=0; i< 8; i++)
{
printf("%c", 206);
gotoxy(37, 3+i);
}
//Canh phai
gotoxy(86, 3);
for(... |
C | #include <stdio.h>
int main() {
printf("Insira os numeros: \n");
int perfeito1;
scanf("%d",&perfeito1);
int perfeito2;
scanf("%d",&perfeito2);
int flag1=0;
int flag2=0;
for(int i=1; i<perfeito1; i++){
if(perfeito1%i==0){
flag1+=i;
}
}
for(int z=1; z<perfeito2; z++){
if(perfeito2%z... |
C | #include "Seqlist.h"
//void SeqlistInit(pSeqlist s);//ʼ˳
//int FindSeqlist(pSeqlist s, Datatype value);//
//void SeqlistPushback(pSeqlist s, Datatype value);//β
//void SeqlistPushfront(pSeqlist s, Datatype value);//ͷ
//void SeqlistPopback(pSeqlist s);//βɾ
//void SeqlistPopfront(pSeqlist s);//ͷɾ
//void PrintSeqlist(pSe... |
C | //============================================================================
// Johns Hopkins University Engineering for Professionals
// 605.467 Computer Graphics and 605.767 Applied Computer Graphics
// Instructor: David W. Nesbitt
//
// Author: David W. Nesbitt
// File: Plane.h
// Purpose: Structures to... |
C | /***************************************************************************************
* FileName : climb2.0.c
* CopyRight : None
* ModuleName :
*
* CPU :
* RTOS :
*
* Create Data : 2020/4/8
* Author/Corportation : Hz
*
* Abstract Description : ÿֻһ̨ʱn̨ мַʽ
*
*-------------... |
C | #include "Includes.h"
int XOR(int Value)
{
if (Value != szKeyLen)
return Value ^ szKeyLen;
else if (Value != 1337)
return Value ^ 1337;
else
return Value ^ (szKeyLen + 1);
}
void SZXOR(char* buffer, int buffSize)
{
int len = strlen(buffer);
if (buffSize)
{
memset(buffer + len, 0, buff... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.